updated category watch control

v1.18.x
barisusakli 9 years ago
parent 5d2e5377c5
commit a141f6f7ec

@ -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",

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

Loading…
Cancel
Save