deps: ember-cli-active-link-wrapper@0.3.2

- we were using borrowed code from an older version, now that ember-cli-active-link-wrapper has a built-in mixin we can just use that
- this fixes render issues with ember 2.10
This commit is contained in:
Austin Burdine 2016-11-23 15:28:49 -07:00 committed by Kevin Ansfield
parent a155d4f652
commit f955de1e31
3 changed files with 3 additions and 36 deletions

View File

@ -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'],

View File

@ -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);
});
}
});

View File

@ -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",