mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 02:52:44 +08:00
FIX: Scroll to top on badge pages (#13694)
…so we don't end up at a random point on the page after a transition.
This commit is contained in:
parent
aebc6164fc
commit
efac01d259
|
@ -2,6 +2,8 @@ import Badge from "discourse/models/badge";
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import I18n from "I18n";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
import { scrollTop } from "discourse/mixins/scroll-top";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
model() {
|
||||
|
@ -18,10 +20,10 @@ export default DiscourseRoute.extend({
|
|||
return I18n.t("badges.title");
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
scrollTop();
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,7 +2,9 @@ import Badge from "discourse/models/badge";
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import PreloadStore from "discourse/lib/preload-store";
|
||||
import UserBadge from "discourse/models/user-badge";
|
||||
import { scrollTop } from "discourse/mixins/scroll-top";
|
||||
import { hash } from "rsvp";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
queryParams: {
|
||||
|
@ -10,12 +12,6 @@ export default DiscourseRoute.extend({
|
|||
refreshModel: true,
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor("badges/show")._showFooter();
|
||||
return true;
|
||||
},
|
||||
},
|
||||
|
||||
serialize(model) {
|
||||
return model.getProperties("id", "slug");
|
||||
|
@ -68,4 +64,11 @@ export default DiscourseRoute.extend({
|
|||
controller.set("userBadges", this.userBadgesGrant);
|
||||
controller.set("userBadgesAll", this.userBadgesAll);
|
||||
},
|
||||
|
||||
@action
|
||||
didTransition() {
|
||||
this.controllerFor("badges/show")._showFooter();
|
||||
scrollTop();
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user