diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index a649a243f0..bc97a6bac7 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -93,7 +93,7 @@ var ajaxify = ajaxify || {}; templates.parse(tpl_url, data, function(template) { translator.translate(template, function(translatedTemplate) { $('#content').html(translatedTemplate); - ajaxify.widgets.render(tpl_url, function() { + ajaxify.widgets.render(tpl_url, url, function() { if (typeof callback === 'function') { callback(); } diff --git a/public/src/widgets.js b/public/src/widgets.js index edc4f2bc7e..eb73e95d36 100644 --- a/public/src/widgets.js +++ b/public/src/widgets.js @@ -1,5 +1,5 @@ "use strict"; -/*global ajaxify, socket, templates*/ +/*global ajaxify, templates*/ (function(ajaxify) { ajaxify.widgets = {}; @@ -14,7 +14,7 @@ }); }; - ajaxify.widgets.render = function(tpl_url, callback) { + ajaxify.widgets.render = function(template, url, callback) { var widgetLocations = ['sidebar', 'footer', 'header'], numLocations; $('#content [widget-area]').each(function() { @@ -29,11 +29,16 @@ if (!numLocations) { ajaxify.widgets.reposition(); } - + function renderWidgets(location) { - var area = $('#content [widget-area="' + location + '"]'); - - $.get(RELATIVE_PATH + '/api/widgets/render/' + tpl_url + '/' + location, function(renderedWidgets) { + var area = $('#content [widget-area="' + location + '"]'), + areaData = { + location: location, + template: template + '.tpl', + url: url + }; + + $.get(RELATIVE_PATH + '/api/widgets/render', areaData, function(renderedWidgets) { var html = ''; for (var i=0; i