1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 07:54:25 +02:00

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).
This commit is contained in:
Toby Zerner
2015-03-20 10:40:42 +10:30
parent 98d1ce1a00
commit 976d97877b
10 changed files with 97 additions and 18 deletions

View File

@@ -1,8 +1,11 @@
import Ember from 'ember';
import PostStream from 'flarum/models/post-stream';
import PushesHistory from 'flarum/mixins/pushes-history';
export default Ember.Route.extend(PushesHistory, {
historyKey: 'discussion',
export default Ember.Route.extend({
queryParams: {
start: {replace: true}
},
@@ -33,7 +36,7 @@ export default Ember.Route.extend({
},
setupController: function(controller, discussion) {
controller.set('model', discussion);
this._super(controller, discussion);
this.controllerFor('index/index').set('lastDiscussion', discussion);
// Set up the post stream object. It needs to know about the discussion
@@ -94,6 +97,8 @@ export default Ember.Route.extend({
actions: {
queryParamsDidChange: function(params) {
this._super(params);
// If the ?start param has changed, we want to tell the view to
// tell the streamContent component to jump to this start point.
// We postpone running this code until the next run loop because