1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/utils/link-component.js

21 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';
})
});