mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
22 lines
597 B
JavaScript
22 lines
597 B
JavaScript
import Ember from 'ember';
|
|
import computed from 'ember-computed';
|
|
import {invokeAction} from 'ember-invoke-action';
|
|
|
|
const {LinkComponent} = Ember;
|
|
|
|
LinkComponent.reopen({
|
|
active: computed('attrs.params', '_routing.currentState', function () {
|
|
let isActive = this._super(...arguments);
|
|
|
|
if (typeof this.get('alternateActive') === 'function') {
|
|
invokeAction(this, 'alternateActive', isActive);
|
|
}
|
|
|
|
return isActive;
|
|
}),
|
|
|
|
activeClass: computed('tagName', function () {
|
|
return this.get('tagName') === 'button' ? '' : 'active';
|
|
})
|
|
});
|