Last active
June 4, 2018 00:56
-
-
Save c4milo/da50016b6a6a6782d1b3 to your computer and use it in GitHub Desktop.
Revisions
-
c4milo revised this gist
Feb 20, 2016 . 1 changed file with 14 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,19 +11,28 @@ export default Ember.Component.extend({ let last = routeNames[len - 1]; if (last === 'index' && len > 1) { routeNames.pop(); len--; } let routes = []; let container = Ember.getOwner(this); let name = ''; for (let i = 0; i < len; i++) { // if name is not empty then it means we are dealing with a nested route. So // we need to lookup the entire name. if (name != '') { name += '.' + routeNames[i]; } else { name = routeNames[i]; } let route = container.lookup(`route:${name}`); if (!route || !route.label) { console.warn(`hooklift-breadcrumb: route label for "${name}" pod was not found. Skipping.`); continue; } routes.push({ name: name, label: route.label }); } return routes; -
c4milo revised this gist
Feb 16, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,6 @@ import Ember from 'ember'; export default Ember.Route.extend({ label: 'Metrics', title: Ember.computed('label', function () { return `Hooklift | ${this.get('label')}`; }), }); -
c4milo created this gist
Feb 16, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ import Ember from 'ember'; export default Ember.Component.extend({ tagName: '', // Does not let Ember inject HTML into the component. routing: Ember.inject.service('-routing'), breadcrumbs: Ember.computed('routing.currentRouteName', function () { let routeName = this.get('routing.currentRouteName'); let routeNames = routeName.split('.'); let len = routeNames.length; let last = routeNames[len - 1]; if (last === 'index' && len > 1) { routeNames.pop(); } let routes = []; let container = Ember.getOwner(this); for (let i = 0; i < len; i++) { let name = routeNames[i]; let label = container.lookup('route:' + name).label; if (!label) { console.warn("hooklift-breadcrumb: route label for '%s' pod was not found. Skipping.", name); continue; } routes.push({ name: name, label: label }); } return routes; }), }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ import Ember from 'ember'; export default Ember.Route.extend({ label: 'Metrics', title: Ember.computed('label', function () { return 'Hooklift | ' + this.get('label'); }), }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ <div class="header-bar-item crumbs"> {{#each breadcrumbs as |route|}} {{#link-to route.name class='crumbs-item'}}{{route.label}}{{/link-to}} {{/each}} </div>