From 0babc3a23b12e78fb7003b437951907647c4128b Mon Sep 17 00:00:00 2001 From: eugenisan Date: Mon, 23 Mar 2015 20:54:23 +0100 Subject: [PATCH] Title as function and no autocapitalise Added options to run title as a function and noCaps parameter --- lib/breadcrumb.js | 5 ++++- package.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/breadcrumb.js b/lib/breadcrumb.js index 27a438f..4ed8f20 100644 --- a/lib/breadcrumb.js +++ b/lib/breadcrumb.js @@ -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'; diff --git a/package.js b/package.js index 2db2cb8..b45bede 100644 --- a/package.js +++ b/package.js @@ -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/' });