2017-08-22 10:53:26 +03:00
|
|
|
import LinkComponent from '@ember/routing/link-component';
|
|
|
|
import {computed} from '@ember/object';
|
2015-06-13 17:34:09 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
LinkComponent.reopen({
|
|
|
|
active: computed('attrs.params', '_routing.currentState', function () {
|
|
|
|
let isActive = this._super(...arguments);
|
2014-04-02 06:09:28 +04:00
|
|
|
|
2019-03-06 16:53:54 +03:00
|
|
|
if (typeof this.alternateActive === 'function') {
|
|
|
|
this.alternateActive(isActive);
|
2015-07-09 00:08:36 +03:00
|
|
|
}
|
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 () {
|
2019-03-06 16:53:54 +03:00
|
|
|
return this.tagName === 'button' ? '' : 'active';
|
2014-04-02 06:09:28 +04:00
|
|
|
})
|
|
|
|
});
|