This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/breadcrumbs_component.js
2013-10-24 15:19:15 -04:00

20 lines
670 B
JavaScript

Discourse.DiscourseBreadcrumbsComponent = Ember.Component.extend({
classNames: ['category-breadcrumb'],
tagName: 'ol',
parentCategory: Em.computed.alias('category.parentCategory'),
parentCategories: Em.computed.filter('categories', function(c) {
return !c.get('parentCategory');
}),
targetCategory: function() {
// Note we can't use Em.computed.or here because it returns a boolean not the object
return this.get('parentCategory') || this.get('category');
}.property('parentCategory', 'category'),
childCategories: Em.computed.filter('categories', function(c) {
return c.get('parentCategory') === this.get('targetCategory');
})
});