Created
June 1, 2015 22:21
-
-
Save poteto/f92c2f7b5c00aa792831 to your computer and use it in GitHub Desktop.
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 characters
_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