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:
commit
1f669a631d
3 changed files with 13 additions and 3 deletions
|
@ -8,5 +8,13 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
unfocusLink: function () {
|
unfocusLink: function () {
|
||||||
this.$('a').blur();
|
this.$('a').blur();
|
||||||
}.on('click')
|
}.on('click'),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
setActive: function (value) {
|
||||||
|
Ember.run.schedule('afterRender', this, function () {
|
||||||
|
this.set('active', value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
|
@ -4,7 +4,9 @@ Ember.LinkComponent.reopen({
|
||||||
active: Ember.computed('attrs.params', '_routing.currentState', function () {
|
active: Ember.computed('attrs.params', '_routing.currentState', function () {
|
||||||
var isActive = this._super();
|
var isActive = this._super();
|
||||||
|
|
||||||
Ember.set(this, 'alternateActive', isActive);
|
if (typeof this.attrs.alternateActive === 'function') {
|
||||||
|
this.attrs.alternateActive(isActive);
|
||||||
|
}
|
||||||
|
|
||||||
return isActive;
|
return isActive;
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue