framework/ember/app/mixins/pushes-history.js
Toby Zerner 976d97877b Improve global back button. Goes back to previous interface.
It’s not quite like the browser’s back button because it doesn’t
necessarily go back to the last URL; rather, it goes back to the last
interface. So if you go into a discussion, then go to a different
discussion via the side pane, the back button will still take you back
to the index (not the previous discussion).
2015-03-20 10:40:42 +10:30

21 lines
444 B
JavaScript

import Ember from 'ember';
export default Ember.Mixin.create({
pushHistory: function() {
Ember.run.next(this, function() {
this.controllerFor('application').pushHistory(this.get('historyKey'), this.get('url'));
});
},
setupController: function(controller, model) {
this._super(controller, model);
this.pushHistory();
},
actions: {
queryParamsDidChange: function() {
this.pushHistory();
}
}
})