FIX: ensures ordering set in tags-show queryString works at first load (#6951)

This commit is contained in:
Joffrey JAFFEUX 2019-01-25 16:48:20 +01:00 committed by GitHub
parent d338e54f59
commit 7caa28cf45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,11 @@ import PermissionType from "discourse/models/permission-type";
export default Discourse.Route.extend({ export default Discourse.Route.extend({
navMode: "latest", navMode: "latest",
queryParams: {
ascending: { refreshModel: true },
order: { refreshModel: true }
},
renderTemplate() { renderTemplate() {
const controller = this.controllerFor("tags.show"); const controller = this.controllerFor("tags.show");
this.render("tags.show", { controller }); this.render("tags.show", { controller });
@ -60,11 +65,13 @@ export default Discourse.Route.extend({
return tag; return tag;
}, },
afterModel(tag) { afterModel(tag, transition) {
const controller = this.controllerFor("tags.show"); const controller = this.controllerFor("tags.show");
controller.set("loading", true); controller.set("loading", true);
const params = controller.getProperties("order", "ascending"); const params = controller.getProperties("order", "ascending");
params.order = transition.queryParams.order || params.order;
params.ascending = transition.queryParams.ascending || params.ascending;
const categorySlug = this.get("categorySlug"); const categorySlug = this.get("categorySlug");
const parentCategorySlug = this.get("parentCategorySlug"); const parentCategorySlug = this.get("parentCategorySlug");