mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
Add disable/enable category to category edit page (#8118)
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
e06c1bfcd2
commit
879acc85ae
@@ -227,6 +227,22 @@ define('admin/manage/category', [
|
||||
$('button[data-action="setParent"]').removeClass('hide');
|
||||
});
|
||||
});
|
||||
$('button[data-action="toggle"]').on('click', function () {
|
||||
var payload = {};
|
||||
var $this = $(this);
|
||||
var disabled = $this.attr('data-disabled') === '1';
|
||||
payload[ajaxify.data.category.cid] = {
|
||||
disabled: disabled ? 0 : 1,
|
||||
};
|
||||
socket.emit('admin.categories.update', payload, function (err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
$this.translateText(!disabled ? '[[admin/manage/categories:enable]]' : '[[admin/manage/categories:disable]]');
|
||||
$this.toggleClass('btn-primary', !disabled).toggleClass('btn-danger', disabled);
|
||||
$this.attr('data-disabled', disabled ? 0 : 1);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function modified(el) {
|
||||
|
||||
Reference in New Issue
Block a user