v1.18.x
barisusakli 11 years ago
parent ec9cc52d03
commit 341a0c8190

@ -298,20 +298,18 @@ define('forum/admin/themes', ['forum/admin/settings'], function(Settings) {
$.get(RELATIVE_PATH + '/api/admin/themes', function(data) { $.get(RELATIVE_PATH + '/api/admin/themes', function(data) {
var areas = data.areas; var areas = data.areas;
for (var a in areas) { for(var i=0; i<areas.length; ++i) {
if (areas.hasOwnProperty(a)) { var area = areas[i],
var area = areas[a], widgetArea = $('#widgets .area[data-template="' + area.template + '"][data-location="' + area.location + '"]').find('.widget-area');
widgetArea = $('#widgets .area[data-template="' + area.template + '"][data-location="' + area.location + '"]').find('.widget-area');
widgetArea.html('');
for (var i in area.data) {
if (area.data.hasOwnProperty(i)) { for (var k=0; k<area.data.length; ++k) {
var widgetData = area.data[i], var widgetData = area.data[k],
widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone(); widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone();
widgetArea.append(populateWidget(widgetEl, widgetData.data)); widgetArea.append(populateWidget(widgetEl, widgetData.data));
appendToggle(widgetEl); appendToggle(widgetEl);
}
}
} }
} }
}); });

@ -46,12 +46,12 @@
} }
if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) { if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) {
if (location === 'footer') { if (location === 'footer' && !$('#content [widget-area="footer"]').length) {
$('#content').append($('<div class="col-xs-12"><div widget-area="footer"></div></div>')); $('#content').append($('<div class="col-xs-12"><div widget-area="footer"></div></div>'));
} else if (location === 'sidebar') { } else if (location === 'sidebar' && !$('#content [widget-area="sidebar"]').length) {
$('#content > *').wrapAll($('<div class="col-lg-9 col-xs-12"></div>')); $('#content > *').wrapAll($('<div class="col-lg-9 col-xs-12"></div>'));
$('#content').append($('<div class="col-lg-3 col-xs-12"><div widget-area="sidebar"></div></div>')); $('#content').append($('<div class="col-lg-3 col-xs-12"><div widget-area="sidebar"></div></div>'));
} else if (location === 'header') { } else if (location === 'header' && !$('#content [widget-area="header"]').length) {
$('#content').prepend($('<div class="col-xs-12"><div widget-area="header"></div></div>')); $('#content').prepend($('<div class="col-xs-12"><div widget-area="header"></div></div>'));
} }

Loading…
Cancel
Save