0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #5535 from jaswilli/linkto

Rework gh-activating-list-item for new link-to
This commit is contained in:
Hannah Wolfe 2015-07-09 09:58:10 +01:00
commit 1f669a631d
3 changed files with 13 additions and 3 deletions

View file

@ -8,5 +8,13 @@ export default Ember.Component.extend({
unfocusLink: function () {
this.$('a').blur();
}.on('click')
}.on('click'),
actions: {
setActive: function (value) {
Ember.run.schedule('afterRender', this, function () {
this.set('active', value);
});
}
}
});

View file

@ -1 +1 @@
{{#link-to route alternateActive=active classNameBindings="linkClasses"}}{{title}}{{yield}}{{/link-to}}
{{#link-to route alternateActive=(action "setActive") classNameBindings="linkClasses"}}{{title}}{{yield}}{{/link-to}}

View file

@ -4,7 +4,9 @@ Ember.LinkComponent.reopen({
active: Ember.computed('attrs.params', '_routing.currentState', function () {
var isActive = this._super();
Ember.set(this, 'alternateActive', isActive);
if (typeof this.attrs.alternateActive === 'function') {
this.attrs.alternateActive(isActive);
}
return isActive;
}),