From 733a999f8ed408821055570881c2550b6f4bb23b Mon Sep 17 00:00:00 2001 From: Dale Tan Date: Sun, 24 Jul 2011 18:06:32 -0400 Subject: [PATCH 1/2] adding helpers to get page id and page classes --- lib/Helpers.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/Helpers.js b/lib/Helpers.js index cb94270ab..bdfab2bd0 100644 --- a/lib/Helpers.js +++ b/lib/Helpers.js @@ -21,7 +21,7 @@ exports = module.exports = { request: function(req,res){ return req; }, - + /** * Translation shortcut */ @@ -137,6 +137,27 @@ exports = module.exports = { }, + /** + * Constructs individual classes based on the url request + */ + getPageClasses: function(req, res) { + return req.url.split('/').join(' '); + }, + + /** + * Constructs a single id based on the url request + */ + gePagetId: function(req, res) { + var urlFrags = req.url.split('/'); + for (var i = 0, len = urlFrags.length; i < len; i++) { + var frag = urlFrags[i]; + if (frag === '') { + urlFrags.splice(i, 1); + } + } + return urlFrags.join('-'); + }, + /** * TODO Include a script in the response. * Thoughts ... What this will actually do is add the file to a internal list. @@ -153,6 +174,10 @@ exports = module.exports = { }; }, + isAdminPage: function (req, res) { + return (/^\/admin/).test(req.url); + }, + /** * TODO Retrieve the concatenated / minified js scripts to add to template. */ From a825fb188b89e582b04fc6e5954c2261c025ec9c Mon Sep 17 00:00:00 2001 From: Dale Tan Date: Mon, 25 Jul 2011 08:58:14 -0400 Subject: [PATCH 2/2] removed isAdmin --- lib/Helpers.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/Helpers.js b/lib/Helpers.js index bdfab2bd0..53080b5e7 100644 --- a/lib/Helpers.js +++ b/lib/Helpers.js @@ -174,10 +174,6 @@ exports = module.exports = { }; }, - isAdminPage: function (req, res) { - return (/^\/admin/).test(req.url); - }, - /** * TODO Retrieve the concatenated / minified js scripts to add to template. */