2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-06-13 17:34:09 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
const {LinkComponent, computed} = Ember;
|
|
|
|
|
|
|
|
LinkComponent.reopen({
|
|
|
|
active: computed('attrs.params', '_routing.currentState', function () {
|
|
|
|
let isActive = this._super(...arguments);
|
2014-04-02 06:09:28 +04:00
|
|
|
|
2015-07-09 00:08:36 +03:00
|
|
|
if (typeof this.attrs.alternateActive === 'function') {
|
|
|
|
this.attrs.alternateActive(isActive);
|
|
|
|
}
|
2014-04-02 06:09:28 +04:00
|
|
|
|
|
|
|
return isActive;
|
2014-09-10 00:58:12 +04:00
|
|
|
}),
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
activeClass: computed('tagName', function () {
|
2014-09-10 00:58:12 +04:00
|
|
|
return this.get('tagName') === 'button' ? '' : 'active';
|
2014-04-02 06:09:28 +04:00
|
|
|
})
|
|
|
|
});
|