Skip to content

Instantly share code, notes, and snippets.

@poteto
Created June 1, 2015 22:21
Show Gist options
  • Save poteto/f92c2f7b5c00aa792831 to your computer and use it in GitHub Desktop.
Save poteto/f92c2f7b5c00aa792831 to your computer and use it in GitHub Desktop.
_lookupBreadCrumb(routeNames, filteredRouteNames) {
const defaultLinkable = get(this, 'linkable');
const breadCrumbs = map(filteredRouteNames, (name, index) => {
const path = this._guessRoutePath(routeNames, name, index);
let breadCrumb = this._lookupRoute(path).getWithDefault('breadCrumb', undefined);
const breadCrumbType = typeOf(breadCrumb);
if (breadCrumbType === 'undefined') {
breadCrumb = {
path,
linkable: defaultLinkable,
title: classify(name)
};
} else if (breadCrumbType === 'null') {
return;
} else {
setProperties(breadCrumb, {
path,
linkable: breadCrumb.hasOwnProperty('linkable') ? breadCrumb.linkable : defaultLinkable
});
}
return breadCrumb;
});
return emberArray(filter(breadCrumbs, (breadCrumb) => {
return typeOf(breadCrumb) !== 'undefined';
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment