Skip to content

Node.js based forum software built for the modern web

updated category watch control

barisusaklia141f6f7ec2a
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]]');
});