Ghost/ghost/admin/app/utils/link-component.js
Kevin Ansfield 983110d931 Switched from ember-cli-shims to new module imports (#779)
no issue

- add eslint-plugin-ember, configure no-old-shims rule
- run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports
- further cleanup of Ember globals usage
- remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
2017-08-22 14:53:26 +07:00

20 lines
598 B
JavaScript

import LinkComponent from '@ember/routing/link-component';
import {computed} from '@ember/object';
import {invokeAction} from 'ember-invoke-action';
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';
})
});