From a141f6f7ec2a736addc2e61151b125259880fc51 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 18 May 2016 20:02:34 +0300 Subject: [PATCH] updated category watch control --- public/language/en_GB/category.json | 4 ++++ public/src/client/category.js | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/language/en_GB/category.json b/public/language/en_GB/category.json index f8b02f32f8..d4da76f356 100644 --- a/public/language/en_GB/category.json +++ b/public/language/en_GB/category.json @@ -13,6 +13,10 @@ "share_this_category": "Share this category", "watch": "Watch", "ignore": "Ignore", + "watching": "Watching", + "ignoring": "Ignoring", + "watching.description": "Show topics in unread", + "ignoring.description": "Do not show topics in unread", "watch.message": "You are now watching updates from this category", "ignore.message": "You are now ignoring updates from this category", diff --git a/public/src/client/category.js b/public/src/client/category.js index a441ff5d08..5f44197a6c 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -62,17 +62,20 @@ define('forum/category', [ }; function handleIgnoreWatch(cid) { - $('.watch, .ignore').on('click', function() { + $('[component="category/watching"], [component="category/ignoring"]').on('click', function() { var $this = $(this); - var command = $this.hasClass('watch') ? 'watch' : 'ignore'; + var command = $this.attr('component') === 'category/watching' ? 'watch' : 'ignore'; socket.emit('categories.' + command, cid, function(err) { if (err) { return app.alertError(err.message); } - $('.watch').toggleClass('hidden', command === 'watch'); - $('.ignore').toggleClass('hidden', command === 'ignore'); + $('[component="category/watching/menu"]').toggleClass('hidden', command !== 'watch'); + $('[component="category/watching/check"]').toggleClass('fa-check', command === 'watch'); + + $('[component="category/ignoring/menu"]').toggleClass('hidden', command !== 'ignore'); + $('[component="category/ignoring/check"]').toggleClass('fa-check', command === 'ignore'); app.alertSuccess('[[category:' + command + '.message]]'); });