mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
plugins: filter:server.create_routes - allow plugins to add custom templates and/or modify individual blocks withiin a template
This commit is contained in:
@@ -807,7 +807,8 @@ var path = require('path'),
|
||||
|
||||
var custom_routes = {
|
||||
'routes': [],
|
||||
'api': []
|
||||
'api': [],
|
||||
'templates': []
|
||||
};
|
||||
|
||||
plugins.ready(function() {
|
||||
@@ -843,6 +844,17 @@ var path = require('path'),
|
||||
}
|
||||
}
|
||||
|
||||
var templateRoutes = custom_routes.templates;
|
||||
for (var route in templateRoutes) {
|
||||
if (templateRoutes.hasOwnProperty(route)) {
|
||||
(function(route) {
|
||||
app.get('/templates/' + templateRoutes[route].template, function(req, res) {
|
||||
res.send(templateRoutes[route].content);
|
||||
});
|
||||
}(route));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user