v1.18.x
psychobunny 11 years ago
parent baadd0f2ed
commit 40cc21fad8

@ -200,11 +200,15 @@ define(['forum/admin/settings'], function(Settings) {
$(this).parents('.panel').children('.panel-body').toggleClass('hidden');
});
$('#widgets .btn[data-template]').on('click', function() {
var btn = $(this),
template = btn.attr('data-template'),
location = btn.attr('data-location'),
area = btn.parents('.area').children('.widget-area'),
$('#widgets .btn[data-template]').on('click', saveWidgets);
function saveWidgets() {
$('#widgets .btn[data-template]').each(function(i, el) {
el = $(el);
var template = el.attr('data-template'),
location = el.attr('data-location'),
area = el.parents('.area').children('.widget-area'),
widgets = [];
area.find('.panel[data-widget]').each(function() {
@ -224,7 +228,7 @@ define(['forum/admin/settings'], function(Settings) {
data: widgetData
});
});
console.log(template, location, widgets);
socket.emit('admin.widgets.set', {
template: template,
location: location,
@ -234,11 +238,12 @@ define(['forum/admin/settings'], function(Settings) {
alert_id: 'admin:widgets',
type: err ? 'danger' : 'success',
title: err ? 'Error' : 'Widgets Updated',
message: err ? err : 'Successfully updated widgets',
message: err ? err.message : 'Successfully updated widgets in ' + template + '/' + location,
timeout: 2500
});
});
});
}
function populateWidget(widget, data) {
widget.find('input, textarea').each(function() {

Loading…
Cancel
Save