Merge pull request #3618 from jongarrison/master

Revised: Added req and res objects to the widget rendering process
This commit is contained in:
Barış Soner Uşaklı
2015-09-16 20:50:49 -04:00
2 changed files with 13 additions and 7 deletions

View File

@@ -114,11 +114,15 @@ apiController.renderWidgets = function(req, res, next) {
return res.status(200).json({});
}
widgets.render(req.uid, {
template: areas.template,
url: areas.url,
locations: areas.locations
}, function(err, widgets) {
widgets.render(req.uid,
{
template: areas.template,
url: areas.url,
locations: areas.locations,
},
req,
res,
function(err, widgets) {
if (err) {
return next(err);
}

View File

@@ -10,7 +10,7 @@ var async = require('async'),
var widgets = {};
widgets.render = function(uid, area, callback) {
widgets.render = function(uid, area, req, res, callback) {
if (!area.locations || !area.template) {
return callback(new Error('[[error:invalid-data]]'));
}
@@ -37,7 +37,9 @@ widgets.render = function(uid, area, callback) {
plugins.fireHook('filter:widget.render:' + widget.widget, {
uid: uid,
area: area,
data: widget.data
data: widget.data,
req: req,
res: res
}, function(err, html) {
if (err) {
return next(err);