mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
fixing bug introduced @ da0355ef79 (multiple widget areas defined = explosion)
This commit is contained in:
@@ -165,22 +165,26 @@ var ajaxify = {};
|
|||||||
|
|
||||||
numLocations = widgetLocations.length;
|
numLocations = widgetLocations.length;
|
||||||
|
|
||||||
function renderWidget(err, renderedWidgets) {
|
function renderWidgets(location) {
|
||||||
if (area.html()) {
|
var area = $('#content [widget-area="' + location + '"]');
|
||||||
area.html(templates.prepare(area.html()).parse({
|
|
||||||
widgets: renderedWidgets
|
|
||||||
})).removeClass('hidden');
|
|
||||||
|
|
||||||
if (!renderedWidgets.length) {
|
socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, function(err, renderedWidgets) {
|
||||||
$('body [no-widget-class]').each(function() {
|
if (area.html()) {
|
||||||
var $this = $(this);
|
area.html(templates.prepare(area.html()).parse({
|
||||||
$this.removeClass();
|
widgets: renderedWidgets
|
||||||
$this.addClass($this.attr('no-widget-class'));
|
})).removeClass('hidden');
|
||||||
});
|
|
||||||
|
if (!renderedWidgets.length) {
|
||||||
|
$('body [no-widget-class]').each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.removeClass();
|
||||||
|
$this.addClass($this.attr('no-widget-class'));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
checkCallback();
|
checkCallback();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCallback() {
|
function checkCallback() {
|
||||||
@@ -192,10 +196,7 @@ var ajaxify = {};
|
|||||||
|
|
||||||
for (var i in widgetLocations) {
|
for (var i in widgetLocations) {
|
||||||
if (widgetLocations.hasOwnProperty(i)) {
|
if (widgetLocations.hasOwnProperty(i)) {
|
||||||
var location = widgetLocations,
|
renderWidgets(widgetLocations[i]);
|
||||||
area = $('#content [widget-area="' + location + '"]');
|
|
||||||
|
|
||||||
socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, renderWidget);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
/*global define, templates, app, bootbox, socket, translator, config, ajaxify, RELATIVE_PATH*/
|
||||||
|
|
||||||
define(['composer', 'forum/pagination'], function(composer, pagination) {
|
define(['composer', 'forum/pagination'], function(composer, pagination) {
|
||||||
var Topic = {},
|
var Topic = {},
|
||||||
infiniteLoaderActive = false,
|
infiniteLoaderActive = false,
|
||||||
@@ -51,9 +54,17 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
|
|
||||||
showBottomPostBar();
|
showBottomPostBar();
|
||||||
|
|
||||||
if (thread_state.locked === '1') set_locked_state(true);
|
if (thread_state.locked === '1') {
|
||||||
if (thread_state.deleted === '1') set_delete_state(true);
|
set_locked_state(true);
|
||||||
if (thread_state.pinned === '1') set_pinned_state(true);
|
}
|
||||||
|
|
||||||
|
if (thread_state.deleted === '1') {
|
||||||
|
set_delete_state(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thread_state.pinned === '1') {
|
||||||
|
set_pinned_state(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (expose_tools === '1') {
|
if (expose_tools === '1') {
|
||||||
var moveThreadModal = $('#move_thread_modal');
|
var moveThreadModal = $('#move_thread_modal');
|
||||||
@@ -218,10 +229,12 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
|
|||||||
app.alertSuccess(translated);
|
app.alertSuccess(translated);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function removePost() {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
|
||||||
for(var i=0; i<pids.length; ++i) {
|
for(var i=0; i<pids.length; ++i) {
|
||||||
$('#post-container li[data-pid="' + pids[i] + '"]').fadeOut(500, function() {
|
$('#post-container li[data-pid="' + pids[i] + '"]').fadeOut(500, removePost);
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
closeForkModal();
|
closeForkModal();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user