From ca46c57e7b50c4fbff1291b21382e5cec3994ae0 Mon Sep 17 00:00:00 2001 From: Niels Boogaard Date: Thu, 2 Jul 2015 14:36:52 +0200 Subject: [PATCH 1/3] Added option to include the 'data' property of the state into the breadcrumb --- src/directives/uiBreadcrumbs/README.md | 4 +++- src/directives/uiBreadcrumbs/uiBreadcrumbs.js | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/directives/uiBreadcrumbs/README.md b/src/directives/uiBreadcrumbs/README.md index 3f78503..06673ad 100644 --- a/src/directives/uiBreadcrumbs/README.md +++ b/src/directives/uiBreadcrumbs/README.md @@ -30,7 +30,8 @@ Assuming you already have your app configured to use ui-router, you then need to ```HTML + [abstract-proxy-property=""] + [include-state-data=""] ``` @@ -39,6 +40,7 @@ route's breadcrumb. If none is specified, or if the specified property is not fo * **`template-url`** (optional) Use this attribute to specify the URL of the `uiBreadcrumbs.tpl.html` file. Alternatively this may be configured in the JavaScript file itself, in which case this attribute would not be needed. * **`abstract-proxy-property`** (optional) Used when working with abstract states. See the section on working with abstract states below for a full explanation. +* **`include-state-data`** (optional) If true is specified, the data property of the state will be added to the breadcrumb to be able to implement additional checks based on that on your custom template file. ## Example setup diff --git a/src/directives/uiBreadcrumbs/uiBreadcrumbs.js b/src/directives/uiBreadcrumbs/uiBreadcrumbs.js index de7ab7e..278d70d 100644 --- a/src/directives/uiBreadcrumbs/uiBreadcrumbs.js +++ b/src/directives/uiBreadcrumbs/uiBreadcrumbs.js @@ -34,7 +34,8 @@ }, scope: { displaynameProperty: '@', - abstractProxyProperty: '@?' + abstractProxyProperty: '@?', + includeStateData: '@?' }, link: function(scope) { scope.breadcrumbs = []; @@ -61,10 +62,14 @@ displayName = getDisplayName(workingState); if (displayName !== false && !stateAlreadyInBreadcrumbs(workingState, breadcrumbs)) { - breadcrumbs.push({ + var breadcrumb = { displayName: displayName, route: workingState.name - }); + }; + if (scope.includeStateData === 'true') { + breadcrumb.data = workingState.data; + } + breadcrumbs.push(breadcrumb); } } currentState = currentState.parent; From d02389b5ddabf73e9ee879288305a9fd4be940cc Mon Sep 17 00:00:00 2001 From: Niels Boogaard Date: Thu, 2 Jul 2015 14:53:50 +0200 Subject: [PATCH 2/3] Made repo public and adjusted homepage --- bower.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 5ce84f3..2d6fe40 100644 --- a/bower.json +++ b/bower.json @@ -1,14 +1,13 @@ { "name": "angularUtils", "version": "0.0.0", - "homepage": "https://github.com/michaelbromley/angularUtils", + "homepage": "https://github.com/nielsboogaard/angularUtils", "authors": [ "Michael Bromley " ], "description": "A collection of AngularJS utilities", "main": "src/angularUtils.js", "license": "MIT", - "private": true, "ignore": [ "**/.*", "node_modules", From a577f37af645d3c012635b5e67206e61f822b07b Mon Sep 17 00:00:00 2001 From: Niels Boogaard Date: Thu, 2 Jul 2015 16:03:05 +0200 Subject: [PATCH 3/3] Fixed property declaration --- src/directives/uiBreadcrumbs/uiBreadcrumbs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/directives/uiBreadcrumbs/uiBreadcrumbs.js b/src/directives/uiBreadcrumbs/uiBreadcrumbs.js index 278d70d..d4dadc8 100644 --- a/src/directives/uiBreadcrumbs/uiBreadcrumbs.js +++ b/src/directives/uiBreadcrumbs/uiBreadcrumbs.js @@ -67,7 +67,7 @@ route: workingState.name }; if (scope.includeStateData === 'true') { - breadcrumb.data = workingState.data; + breadcrumb['data'] = workingState.data; } breadcrumbs.push(breadcrumb); }