Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #83 from dtan/rc
Browse files Browse the repository at this point in the history
adding helpers to get page id and page classes
  • Loading branch information
cliftonc committed Jul 25, 2011
2 parents edcf5b9 + a825fb1 commit 7160010
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports = module.exports = {
request: function(req,res){
return req;
},

/**
* Translation shortcut
*/
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7160010

Please sign in to comment.