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

@ -162,7 +162,7 @@ define('forum/admin/themes', ['forum/admin/settings'], function(Settings) {
Themes.prepareWidgets = function() {
$('[data-location="drafts"]').insertAfter($('[data-location="drafts"]').closest('.tab-content'));
$('#widgets .available-widgets .panel').draggable({
helper: function(e) {
return $(e.target).parents('.panel').clone().addClass('block').width($(e.target.parentNode).width());
@ -298,20 +298,18 @@ define('forum/admin/themes', ['forum/admin/settings'], function(Settings) {
$.get(RELATIVE_PATH + '/api/admin/themes', function(data) {
var areas = data.areas;
for (var a in areas) {
if (areas.hasOwnProperty(a)) {
var area = areas[a],
widgetArea = $('#widgets .area[data-template="' + area.template + '"][data-location="' + area.location + '"]').find('.widget-area');
for(var i=0; i<areas.length; ++i) {
var area = areas[i],
widgetArea = $('#widgets .area[data-template="' + area.template + '"][data-location="' + area.location + '"]').find('.widget-area');
for (var i in area.data) {
if (area.data.hasOwnProperty(i)) {
var widgetData = area.data[i],
widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone();
widgetArea.html('');
widgetArea.append(populateWidget(widgetEl, widgetData.data));
appendToggle(widgetEl);
}
}
for (var k=0; k<area.data.length; ++k) {
var widgetData = area.data[k],
widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone();
widgetArea.append(populateWidget(widgetEl, widgetData.data));
appendToggle(widgetEl);
}
}
});

@ -29,7 +29,7 @@
if (!numLocations) {
ajaxify.widgets.reposition();
}
function renderWidgets(location) {
var area = $('#content [widget-area="' + location + '"]'),
areaData = {
@ -46,12 +46,12 @@
}
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>'));
} 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').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>'));
}

Loading…
Cancel
Save