mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
closes #1100
This commit is contained in:
@@ -200,11 +200,15 @@ define(['forum/admin/settings'], function(Settings) {
|
|||||||
$(this).parents('.panel').children('.panel-body').toggleClass('hidden');
|
$(this).parents('.panel').children('.panel-body').toggleClass('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#widgets .btn[data-template]').on('click', function() {
|
$('#widgets .btn[data-template]').on('click', saveWidgets);
|
||||||
var btn = $(this),
|
|
||||||
template = btn.attr('data-template'),
|
function saveWidgets() {
|
||||||
location = btn.attr('data-location'),
|
$('#widgets .btn[data-template]').each(function(i, el) {
|
||||||
area = btn.parents('.area').children('.widget-area'),
|
el = $(el);
|
||||||
|
|
||||||
|
var template = el.attr('data-template'),
|
||||||
|
location = el.attr('data-location'),
|
||||||
|
area = el.parents('.area').children('.widget-area'),
|
||||||
widgets = [];
|
widgets = [];
|
||||||
|
|
||||||
area.find('.panel[data-widget]').each(function() {
|
area.find('.panel[data-widget]').each(function() {
|
||||||
@@ -224,7 +228,7 @@ define(['forum/admin/settings'], function(Settings) {
|
|||||||
data: widgetData
|
data: widgetData
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
console.log(template, location, widgets);
|
||||||
socket.emit('admin.widgets.set', {
|
socket.emit('admin.widgets.set', {
|
||||||
template: template,
|
template: template,
|
||||||
location: location,
|
location: location,
|
||||||
@@ -234,11 +238,12 @@ define(['forum/admin/settings'], function(Settings) {
|
|||||||
alert_id: 'admin:widgets',
|
alert_id: 'admin:widgets',
|
||||||
type: err ? 'danger' : 'success',
|
type: err ? 'danger' : 'success',
|
||||||
title: err ? 'Error' : 'Widgets Updated',
|
title: err ? 'Error' : 'Widgets Updated',
|
||||||
message: err ? err : 'Successfully updated widgets',
|
message: err ? err.message : 'Successfully updated widgets in ' + template + '/' + location,
|
||||||
timeout: 2500
|
timeout: 2500
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function populateWidget(widget, data) {
|
function populateWidget(widget, data) {
|
||||||
widget.find('input, textarea').each(function() {
|
widget.find('input, textarea').each(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user