mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-24 01:10:31 +01:00
closes #5937
This commit is contained in:
@@ -75,8 +75,7 @@ define('admin/extend/widgets', ['jqueryui'], function () {
|
||||
$('#save').on('click', saveWidgets);
|
||||
|
||||
function saveWidgets() {
|
||||
var total = $('#widgets [data-template][data-location]').length;
|
||||
|
||||
var saveData = [];
|
||||
$('#widgets [data-template][data-location]').each(function (i, el) {
|
||||
el = $(el);
|
||||
|
||||
@@ -112,26 +111,24 @@ define('admin/extend/widgets', ['jqueryui'], function () {
|
||||
});
|
||||
});
|
||||
|
||||
socket.emit('admin.widgets.set', {
|
||||
saveData.push({
|
||||
template: template,
|
||||
location: location,
|
||||
widgets: widgets,
|
||||
}, function (err) {
|
||||
total -= 1;
|
||||
});
|
||||
});
|
||||
|
||||
if (err) {
|
||||
app.alertError(err.message);
|
||||
}
|
||||
socket.emit('admin.widgets.set', saveData, function (err) {
|
||||
if (err) {
|
||||
app.alertError(err.message);
|
||||
}
|
||||
|
||||
if (total === 0) {
|
||||
app.alert({
|
||||
alert_id: 'admin:widgets',
|
||||
type: 'success',
|
||||
title: '[[admin/extend/widgets:alert.updated]]',
|
||||
message: '[[admin/extend/widgets:alert.update-success]]',
|
||||
timeout: 2500,
|
||||
});
|
||||
}
|
||||
app.alert({
|
||||
alert_id: 'admin:widgets',
|
||||
type: 'success',
|
||||
title: '[[admin/extend/widgets:alert.updated]]',
|
||||
message: '[[admin/extend/widgets:alert.update-success]]',
|
||||
timeout: 2500,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user