diff --git a/ghost/admin/app/components/gh-posts-list-item.js b/ghost/admin/app/components/gh-posts-list-item.js index b35b1446fb..fcf455cbd4 100644 --- a/ghost/admin/app/components/gh-posts-list-item.js +++ b/ghost/admin/app/components/gh-posts-list-item.js @@ -5,7 +5,7 @@ import {htmlSafe} from 'ember-string'; import computed, {alias, equal} from 'ember-computed'; import injectService from 'ember-service/inject'; -import ActiveLinkWrapper from 'ghost-admin/mixins/active-link-wrapper'; +import ActiveLinkMixin from 'ember-cli-active-link-wrapper/mixins/active-link'; import {invokeAction} from 'ember-invoke-action'; // ember-cli-shims doesn't export these @@ -13,7 +13,7 @@ const {Handlebars, ObjectProxy, PromiseProxyMixin} = Ember; const ObjectPromiseProxy = ObjectProxy.extend(PromiseProxyMixin); -export default Component.extend(ActiveLinkWrapper, { +export default Component.extend(ActiveLinkMixin, { tagName: 'li', classNameBindings: ['isFeatured:featured', 'isPage:page'], diff --git a/ghost/admin/app/mixins/active-link-wrapper.js b/ghost/admin/app/mixins/active-link-wrapper.js deleted file mode 100644 index 36e3118514..0000000000 --- a/ghost/admin/app/mixins/active-link-wrapper.js +++ /dev/null @@ -1,34 +0,0 @@ -// logic borrowed from https://github.com/alexspeller/ember-cli-active-link-wrapper/blob/master/addon/components/active-link.js -import Mixin from 'ember-metal/mixin'; -import run from 'ember-runloop'; -import computed from 'ember-computed'; -import {A as emberA} from 'ember-array/utils'; -import getOwner from 'ember-owner/get'; - -export default Mixin.create({ - - classNameBindings: ['active'], - - childLinkViews: [], - - active: computed('childLinkViews.@each.active', function () { - return emberA(this.get('childLinkViews')).isAny('active'); - }), - - didRender() { - this._super(...arguments); - - run.scheduleOnce('afterRender', this, function () { - let childLinkElements = this.$('a.ember-view'); - let applicationContainer = getOwner(this).application.__container__; - let viewRegistry = applicationContainer.lookup('-view-registry:main'); - - let childLinkViews = childLinkElements.toArray().map( - (view) => viewRegistry[view.id] - ); - - this.set('childLinkViews', childLinkViews); - }); - } - -}); diff --git a/ghost/admin/package.json b/ghost/admin/package.json index b8d1ac53f7..9f5a809811 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -38,6 +38,7 @@ "csscomb": "3.1.8", "ember-ajax": "2.5.3", "ember-cli": "2.10.0", + "ember-cli-active-link-wrapper": "0.3.2", "ember-cli-app-version": "2.0.1", "ember-cli-babel": "5.2.1", "ember-cli-chai": "0.3.0",