mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
Widgets refactor (#5817)
* widgets refactor render widgets server side widgets can use all the data the template can use * fix tests
This commit is contained in:
committed by
GitHub
parent
65329b9bd7
commit
923bd86662
@@ -7,6 +7,7 @@ var winston = require('winston');
|
||||
|
||||
var plugins = require('../plugins');
|
||||
var translator = require('../translator');
|
||||
var widgets = require('../widgets');
|
||||
|
||||
module.exports = function (middleware) {
|
||||
middleware.processRender = function (req, res, next) {
|
||||
@@ -49,6 +50,17 @@ module.exports = function (middleware) {
|
||||
function (data, next) {
|
||||
options = data.templateData;
|
||||
|
||||
widgets.render(req.uid, {
|
||||
template: template + '.tpl',
|
||||
url: options.url,
|
||||
templateData: options,
|
||||
req: req,
|
||||
res: res,
|
||||
}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
options.widgets = data;
|
||||
|
||||
res.locals.template = template;
|
||||
options._locals = undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user