FIX: always 'return true' when overriding a route action

This commit is contained in:
Régis Hanol 2015-07-31 20:16:37 +02:00
parent 29bdaa0dd8
commit d71301e406
9 changed files with 23 additions and 19 deletions

View File

@ -35,6 +35,7 @@ export default (page) => {
actions: {
didTransition() {
this.controllerFor("application").set("showFooter", true);
return true;
}
}
});

View File

@ -10,6 +10,7 @@ export default Discourse.Route.extend({
actions: {
didTransition() {
this.controllerFor("application").set("showFooter", true);
return true;
}
}
});

View File

@ -14,6 +14,7 @@ export default Discourse.Route.extend({
actions: {
didTransition() {
this.controllerFor("application").set("showFooter", true);
return true;
}
}
});

View File

@ -62,6 +62,7 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
didTransition() {
this.controllerFor("application").set("showFooter", true);
return true;
}
}
});

View File

@ -3,7 +3,7 @@
Handles the logic for showing the loading spinners.
**/
import OpenComposer from "discourse/mixins/open-composer";
import { scrollTop } from 'discourse/mixins/scroll-top';
import { scrollTop } from "discourse/mixins/scroll-top";
const DiscoveryRoute = Discourse.Route.extend(OpenComposer, {
redirect() {
@ -21,20 +21,20 @@ const DiscoveryRoute = Discourse.Route.extend(OpenComposer, {
actions: {
loading() {
this.controllerFor('discovery').set("loading", true);
this.controllerFor("discovery").set("loading", true);
return true;
},
loadingComplete() {
this.controllerFor('discovery').set('loading', false);
if (!this.session.get('topicListScrollPosition')) {
this.controllerFor("discovery").set("loading", false);
if (!this.session.get("topicListScrollPosition")) {
scrollTop();
}
},
didTransition() {
this.controllerFor("discovery")._showFooter();
this.send('loadingComplete');
this.send("loadingComplete");
return true;
},
@ -44,7 +44,7 @@ const DiscoveryRoute = Discourse.Route.extend(OpenComposer, {
},
createTopic() {
this.openComposer(this.controllerFor('discovery/topics'));
this.openComposer(this.controllerFor("discovery/topics"));
}
}

View File

@ -4,9 +4,9 @@ export default UserActivityStreamRoute.extend({
userActionType: undefined,
actions: {
didTransition: function() {
didTransition() {
this._super();
this.controllerFor('user').set('indexStream', true);
this.controllerFor("user").set("indexStream", true);
return true;
}
}

View File

@ -2,20 +2,20 @@ import ViewingActionType from "discourse/mixins/viewing-action-type";
export default Discourse.Route.extend(ViewingActionType, {
model() {
return this.modelFor('user').get('stream');
return this.modelFor("user").get("stream");
},
afterModel() {
return this.modelFor('user').get('stream').filterBy(this.get('userActionType'));
return this.modelFor("user").get("stream").filterBy(this.get("userActionType"));
},
renderTemplate() {
this.render('user_stream');
this.render("user_stream");
},
setupController(controller, model) {
controller.set('model', model);
this.viewingActionType(this.get('userActionType'));
controller.set("model", model);
this.viewingActionType(this.get("userActionType"));
},
actions: {
@ -26,13 +26,13 @@ export default Discourse.Route.extend(ViewingActionType, {
},
removeBookmark(userAction) {
var user = this.modelFor('user');
Discourse.Post.updateBookmark(userAction.get('post_id'), false)
var user = this.modelFor("user");
Discourse.Post.updateBookmark(userAction.get("post_id"), false)
.then(function() {
// remove the user action from the stream
user.get('stream').remove(userAction);
user.get("stream").remove(userAction);
// update the counts
user.get('stats').forEach(function (stat) {
user.get("stats").forEach(function (stat) {
if (stat.get("action_type") === userAction.action_type) {
stat.decrementProperty("count");
}

View File

@ -17,6 +17,7 @@ export default Discourse.Route.extend(ViewingActionType, {
actions: {
didTransition() {
this.controllerFor("application").set("showFooter", true);
return true;
}
}
});

View File

@ -9,8 +9,7 @@ export default Discourse.Route.extend(ViewingActionType, {
},
model() {
var user = this.modelFor("user");
return this.store.find("notification", { username: user.get("username") });
return this.store.find("notification", { username: this.modelFor("user").get("username") });
},
setupController(controller, model) {