Skip to content

Commit

Permalink
Title as function and no autocapitalise
Browse files Browse the repository at this point in the history
Added options to run title as a function and noCaps parameter
  • Loading branch information
eugenisan authored and eugenisan committed Mar 23, 2015
1 parent 9217d55 commit 0babc3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ String.prototype.capitalize = function() {
var enrichRouteObject = function(path, isCurrent) {
// replace all parameters in the title
var title = Router.routes[path].options.title;
if ('function' === typeof title)
title = Router.routes[path].options.title();
var params = Router.current().params;
if(title) {
for (var i in params) {
title = title.replace(
new RegExp((':'+i).replace(/\+/g, "\\+"), "g"), params[i]);
}
title = title.capitalize();
if (!Router.routes[path].options.noCaps)
title = title.capitalize();
} else {
title = 'This page has no title';

Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'monbro:iron-router-breadcrumb',
summary: 'This package will provide a easy way to add a breadcrumb to Iron.Router with enough flexibility.',
version: '1.0.6',
version: '1.0.7',
git: 'https://github.com/monbro/meteor-breadcrumb-plugin/'
});

Expand Down

0 comments on commit 0babc3a

Please sign in to comment.