mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
fix: copy settings showing empty category selection
This commit is contained in:
@@ -124,49 +124,55 @@ define('admin/manage/category', [
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.copy-settings').on('click', function () {
|
$('.copy-settings').on('click', function () {
|
||||||
Benchpress.parse('admin/partials/categories/copy-settings', {
|
socket.emit('categories.getSelectCategories', {}, function (err, allCategories) {
|
||||||
categories: ajaxify.data.allCategories,
|
if (err) {
|
||||||
}, function (html) {
|
return app.alertError(err.message);
|
||||||
var selectedCid;
|
}
|
||||||
var modal = bootbox.dialog({
|
|
||||||
title: '[[modules:composer.select_category]]',
|
|
||||||
message: html,
|
|
||||||
buttons: {
|
|
||||||
save: {
|
|
||||||
label: '[[modules:bootbox.confirm]]',
|
|
||||||
className: 'btn-primary',
|
|
||||||
callback: function () {
|
|
||||||
if (!selectedCid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.emit('admin.categories.copySettingsFrom', {
|
Benchpress.parse('admin/partials/categories/copy-settings', {
|
||||||
fromCid: selectedCid,
|
categories: allCategories,
|
||||||
toCid: ajaxify.data.category.cid,
|
}, function (html) {
|
||||||
copyParent: modal.find('#copyParent').prop('checked'),
|
var selectedCid;
|
||||||
}, function (err) {
|
var modal = bootbox.dialog({
|
||||||
if (err) {
|
title: '[[modules:composer.select_category]]',
|
||||||
return app.alertError(err.message);
|
message: html,
|
||||||
|
buttons: {
|
||||||
|
save: {
|
||||||
|
label: '[[modules:bootbox.confirm]]',
|
||||||
|
className: 'btn-primary',
|
||||||
|
callback: function () {
|
||||||
|
if (!selectedCid || parseInt(selectedCid, 10) === parseInt(ajaxify.data.category.cid, 10)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
modal.modal('hide');
|
socket.emit('admin.categories.copySettingsFrom', {
|
||||||
app.alertSuccess('[[admin/manage/categories:alert.copy-success]]');
|
fromCid: selectedCid,
|
||||||
ajaxify.refresh();
|
toCid: ajaxify.data.category.cid,
|
||||||
});
|
copyParent: modal.find('#copyParent').prop('checked'),
|
||||||
return false;
|
}, function (err) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.modal('hide');
|
||||||
|
app.alertSuccess('[[admin/manage/categories:alert.copy-success]]');
|
||||||
|
ajaxify.refresh();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
});
|
modal.find('.modal-footer button').prop('disabled', true);
|
||||||
modal.find('.modal-footer button').prop('disabled', true);
|
categorySelector.init(modal.find('[component="category-selector"]'), function (selectedCategory) {
|
||||||
categorySelector.init(modal.find('[component="category-selector"]'), function (selectedCategory) {
|
selectedCid = selectedCategory && selectedCategory.cid;
|
||||||
selectedCid = selectedCategory && selectedCategory.cid;
|
if (selectedCid) {
|
||||||
if (selectedCid) {
|
modal.find('.modal-footer button').prop('disabled', false);
|
||||||
modal.find('.modal-footer button').prop('disabled', false);
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.upload-button').on('click', function () {
|
$('.upload-button').on('click', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user