framework/ember/app/components/ui/items/nav-item.js

38 lines
953 B
JavaScript
Raw Normal View History

2014-12-20 14:26:46 +08:00
import Ember from 'ember';
export default Ember.Component.extend({
icon: '',
title: '',
action: null,
badge: '',
tagName: 'li',
classNameBindings: ['active'],
active: function() {
2015-01-03 09:56:14 +08:00
return !! this.get('childViews').anyBy('active');
2014-12-20 14:26:46 +08:00
}.property('childViews.@each.active'),
2015-01-03 09:56:14 +08:00
// init: function() {
// var params = this.params;
// if (params[params.length - 1].queryParams) {
// this.queryParamsObject = {values: params.pop().queryParams};
// }
// this._super();
// },
2014-12-20 14:26:46 +08:00
layout: function() {
2015-01-03 09:56:14 +08:00
return Ember.Handlebars.compile('{{#link-to '+this.get('linkTo')+'}}'+this.get('iconTemplate')+' {{title}} <span class="count">{{badge}}</span>{{/link-to}}');
2014-12-20 14:26:46 +08:00
}.property('linkTo', 'iconTemplate'),
iconTemplate: function() {
return '{{fa-icon icon}}';
}.property(),
actions: {
main: function() {
this.get('action')();
}
}
});