From 42d77080f36f4b8bd0b857b8a2e5884c37f873de Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 30 Dec 2013 16:19:59 -0500 Subject: [PATCH] plugins: filter:server.create_routes - allow plugins to add custom templates and/or modify individual blocks withiin a template --- src/webserver.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/webserver.js b/src/webserver.js index 0ac8e00fe7..3606113cc8 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -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)); + } + } + }); });