mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
render widgets upon ajaxify - this widget feetorez iz completified!
This commit is contained in:
@@ -93,7 +93,7 @@ var ajaxify = {};
|
|||||||
|
|
||||||
translator.load(tpl_url);
|
translator.load(tpl_url);
|
||||||
|
|
||||||
jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
$('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
||||||
|
|
||||||
templates.flush();
|
templates.flush();
|
||||||
templates.load_template(function () {
|
templates.load_template(function () {
|
||||||
@@ -110,11 +110,27 @@ var ajaxify = {};
|
|||||||
|
|
||||||
app.processPage();
|
app.processPage();
|
||||||
|
|
||||||
jQuery('#content, #footer').stop(true, true).removeClass('ajaxifying');
|
var widgetLocations = [];
|
||||||
|
|
||||||
|
require(['vendor/async'], function(async) {
|
||||||
|
$('#content [widget-area]').each(function() {
|
||||||
|
widgetLocations.push(this.getAttribute('widget-area'));
|
||||||
|
});
|
||||||
|
|
||||||
|
async.each(widgetLocations, function(location, next) {
|
||||||
|
var area = $('#content [widget-area="' + location + '"]');
|
||||||
|
|
||||||
|
socket.emit('widgets.render', {template: tpl_url + '.tpl', location: location}, function(err, renderedWidgets) {
|
||||||
|
area.html(templates.prepare(area.html()).parse({widgets: renderedWidgets})).removeClass('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#content, #footer').stop(true, true).removeClass('ajaxifying');
|
||||||
ajaxify.initialLoad = false;
|
ajaxify.initialLoad = false;
|
||||||
|
|
||||||
app.refreshTitle(url);
|
app.refreshTitle(url);
|
||||||
$(window).trigger('action:ajaxify.end', { url: url });
|
$(window).trigger('action:ajaxify.end', { url: url });
|
||||||
|
});
|
||||||
}, url);
|
}, url);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
{motd}
|
{motd}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div widget-area="motd" class="hidden">
|
||||||
|
<!-- BEGIN widgets -->
|
||||||
|
<div class="well">
|
||||||
|
{widgets.html}
|
||||||
|
</div>
|
||||||
|
<!-- END widgets -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row home" itemscope itemtype="http://www.schema.org/ItemList">
|
<div class="row home" itemscope itemtype="http://www.schema.org/ItemList">
|
||||||
<!-- BEGIN categories -->
|
<!-- BEGIN categories -->
|
||||||
<div class="{categories.class}">
|
<div class="{categories.class}">
|
||||||
|
|||||||
Reference in New Issue
Block a user