Ghost/ghost/admin/app/utils/link-component.js

20 lines
506 B
JavaScript
Raw Normal View History

2015-02-13 07:22:32 +03:00
import Ember from 'ember';
const {LinkComponent, computed} = Ember;
LinkComponent.reopen({
active: computed('attrs.params', '_routing.currentState', function () {
let isActive = this._super(...arguments);
if (typeof this.attrs.alternateActive === 'function') {
this.attrs.alternateActive(isActive);
}
return isActive;
}),
activeClass: computed('tagName', function () {
return this.get('tagName') === 'button' ? '' : 'active';
})
});