mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
global widget areas (sidebar/footer) - closes #1097
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
};
|
||||
|
||||
ajaxify.widgets.render = function(tpl_url, url, callback) {
|
||||
var widgetLocations = [], numLocations;
|
||||
var widgetLocations = ['sidebar', 'footer'], numLocations;
|
||||
|
||||
$('#content [widget-area]').each(function() {
|
||||
widgetLocations.push($(this).attr('widget-area'));
|
||||
@@ -28,6 +28,17 @@
|
||||
function renderWidgets(location) {
|
||||
var area = $('#content [widget-area="' + location + '"]');
|
||||
|
||||
if (!area.length && window.location.pathname.indexOf('/admin') === -1) {
|
||||
if (location === 'footer') {
|
||||
$('#content').append($('<div class="col-xs-12"><div widget-area="footer"></div></div>'));
|
||||
} else if (location === 'sidebar') {
|
||||
$('#content > *').wrapAll($('<div class="col-xs-9"></div>'));
|
||||
$('#content').append($('<div class="col-xs-3"><div widget-area="sidebar"></div></div>'));
|
||||
}
|
||||
|
||||
area = $('#content [widget-area="' + location + '"]');
|
||||
}
|
||||
|
||||
socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, function(err, renderedWidgets) {
|
||||
var html = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user