mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
fixed save/delete/purge in category ACP, #2463
This commit is contained in:
@@ -21,7 +21,9 @@ define('admin/manage/category', [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
if(Object.keys(modified_categories).length) {
|
if(Object.keys(modified_categories).length) {
|
||||||
socket.emit('admin.categories.update', modified_categories, function(err, result) {
|
socket.emit('admin.categories.update', modified_categories, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -39,7 +41,6 @@ define('admin/manage/category', [
|
|||||||
});
|
});
|
||||||
modified_categories = {};
|
modified_categories = {};
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.blockclass, form.category select').each(function() {
|
$('.blockclass, form.category select').each(function() {
|
||||||
@@ -85,24 +86,21 @@ define('admin/manage/category', [
|
|||||||
// Colour Picker
|
// Colour Picker
|
||||||
$('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker);
|
$('[data-name="bgColor"], [data-name="color"]').each(enableColorPicker);
|
||||||
|
|
||||||
// Options menu events
|
$('.save').on('click', save);
|
||||||
var optionsEl = $('.options');
|
$('.revert').on('click', ajaxify.refresh);
|
||||||
optionsEl.on('click', '.save', save);
|
$('.purge').on('click', function(e) {
|
||||||
optionsEl.on('click', '.revert', ajaxify.refresh);
|
e.preventDefault();
|
||||||
optionsEl.on('click', '.purge', function() {
|
|
||||||
var categoryRow = $(this).parents('li[data-cid]');
|
|
||||||
var cid = categoryRow.attr('data-cid');
|
|
||||||
|
|
||||||
bootbox.confirm('<p class="lead">Do you really want to purge this category "' + $('form.category').find('input[data-name="name"]').val() + '"?</p><p><strong class="text-danger">Warning!</strong> All topics and posts in this category will be purged!</p>', function(confirm) {
|
bootbox.confirm('<p class="lead">Do you really want to purge this category "' + $('form.category').find('input[data-name="name"]').val() + '"?</p><p><strong class="text-danger">Warning!</strong> All topics and posts in this category will be purged!</p>', function(confirm) {
|
||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('admin.categories.purge', cid, function(err) {
|
socket.emit('admin.categories.purge', ajaxify.variables.get('cid'), function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
app.alertSuccess('Category purged!');
|
app.alertSuccess('Category purged!');
|
||||||
categoryRow.remove();
|
ajaxify.go('admin/manage/categories');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -144,35 +142,6 @@ define('admin/manage/category', [
|
|||||||
|
|
||||||
setupEditTargets();
|
setupEditTargets();
|
||||||
Category.setupPrivilegeTable();
|
Category.setupPrivilegeTable();
|
||||||
|
|
||||||
$(function() {
|
|
||||||
|
|
||||||
|
|
||||||
// $('.admin-categories').on('click', '.permissions', function() {
|
|
||||||
// var cid = $(this).parents('li[data-cid]').attr('data-cid');
|
|
||||||
// Categories.launchPermissionsModal(cid);
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// $('.admin-categories').on('click', '.delete-image', function() {
|
|
||||||
// var parent = $(this).parents('li[data-cid]'),
|
|
||||||
// inputEl = parent.find('.upload-button'),
|
|
||||||
// preview = parent.find('.preview-box'),
|
|
||||||
// bgColor = parent.find('.category_bgColor').val();
|
|
||||||
|
|
||||||
// inputEl.val('');
|
|
||||||
// modified(inputEl[0]);
|
|
||||||
|
|
||||||
// preview.css('background', bgColor);
|
|
||||||
|
|
||||||
// $(this).addClass('hide').hide();
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Category.setupPrivilegeTable = function() {
|
Category.setupPrivilegeTable = function() {
|
||||||
|
|||||||
@@ -168,7 +168,11 @@ $(document).ready(function() {
|
|||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
|
|
||||||
ajaxify.refresh = function() {
|
ajaxify.refresh = function(e) {
|
||||||
|
if (e && e instanceof jQuery.Event) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
ajaxify.go(ajaxify.currentPage);
|
ajaxify.go(ajaxify.currentPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user