From 05c2e0fde521b17a8229ac4d2f0478c71bef17d4 Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Tue, 13 Mar 2012 18:24:45 +0100 Subject: [PATCH] Made all html pages into eejs templates --- src/node/eejs/{eejs.js => index.js} | 0 src/node/hooks/express/specialpages.js | 10 ++++------ src/{static => templates}/index.html | 0 src/{static => templates}/pad.html | 0 src/{static => templates}/timeslider.html | 0 5 files changed, 4 insertions(+), 6 deletions(-) rename src/node/eejs/{eejs.js => index.js} (100%) rename src/{static => templates}/index.html (100%) rename src/{static => templates}/pad.html (100%) rename src/{static => templates}/timeslider.html (100%) diff --git a/src/node/eejs/eejs.js b/src/node/eejs/index.js similarity index 100% rename from src/node/eejs/eejs.js rename to src/node/eejs/index.js diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index 13cfd8215..585a7eab8 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -1,12 +1,12 @@ var path = require('path'); +var eejs = require('ep_etherpad-lite/node/eejs'); exports.expressCreateServer = function (hook_name, args, cb) { //serve index.html under / args.app.get('/', function(req, res) { - var filePath = path.normalize(__dirname + "/../../../static/index.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); + res.send(eejs.require("ep_etherpad-lite/templates/index.html"), { maxAge: exports.maxAge }); }); //serve robots.txt @@ -34,15 +34,13 @@ exports.expressCreateServer = function (hook_name, args, cb) { //serve pad.html under /p args.app.get('/p/:pad', function(req, res, next) { - var filePath = path.normalize(__dirname + "/../../../static/pad.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); + res.send(eejs.require("ep_etherpad-lite/templates/pad.html"), { maxAge: exports.maxAge }); }); //serve timeslider.html under /p/$padname/timeslider args.app.get('/p/:pad/timeslider', function(req, res, next) { - var filePath = path.normalize(__dirname + "/../../../static/timeslider.html"); - res.sendfile(filePath, { maxAge: exports.maxAge }); + res.send(eejs.require("ep_etherpad-lite/templates/timeslider.html"), { maxAge: exports.maxAge }); }); } \ No newline at end of file diff --git a/src/static/index.html b/src/templates/index.html similarity index 100% rename from src/static/index.html rename to src/templates/index.html diff --git a/src/static/pad.html b/src/templates/pad.html similarity index 100% rename from src/static/pad.html rename to src/templates/pad.html diff --git a/src/static/timeslider.html b/src/templates/timeslider.html similarity index 100% rename from src/static/timeslider.html rename to src/templates/timeslider.html