FIX: Display tags topic list correctly when none is selected for subcategories

This commit is contained in:
Daniel Waterworth 2019-11-05 20:06:47 +00:00
parent ca14e3d83c
commit 59241df251
3 changed files with 12 additions and 1 deletions

View File

@ -95,6 +95,7 @@ export default {
});
app["TagsShowCategoryRoute"] = TagsShowRoute.extend();
app["TagsShowCategoryNoneRoute"] = TagsShowRoute.extend({ noSubcategories: true });
app["TagsShowParentCategoryRoute"] = TagsShowRoute.extend();
site.get("filters").forEach(function(filter) {
@ -104,6 +105,9 @@ export default {
app[
"TagsShowCategory" + filter.capitalize() + "Route"
] = TagsShowRoute.extend({ navMode: filter });
app[
"TagsShowNoneCategory" + filter.capitalize() + "Route"
] = TagsShowRoute.extend({ navMode: filter, noSubcategories: true });
app[
"TagsShowParentCategory" + filter.capitalize() + "Route"
] = TagsShowRoute.extend({ navMode: filter });

View File

@ -199,6 +199,7 @@ export default function() {
this.route("tags", { resetNamespace: true }, function() {
this.route("show", { path: "/:tag_id" });
this.route("showCategory", { path: "/c/:category/:tag_id" });
this.route("showCategoryNone", { path: "/c/:category/none/:tag_id" });
this.route("showParentCategory", {
path: "/c/:parent_category/:category/:tag_id"
});
@ -210,6 +211,9 @@ export default function() {
this.route("showCategory" + filter.capitalize(), {
path: "/c/:category/:tag_id/l/" + filter
});
this.route("showCategoryNone" + filter.capitalize(), {
path: "/c/:category/:tag_id/l/" + filter
});
this.route("showParentCategory" + filter.capitalize(), {
path: "/c/:parent_category/:category/:tag_id/l/" + filter
});

View File

@ -85,6 +85,8 @@ export default DiscourseRoute.extend({
);
if (parentCategorySlug) {
filter = `tags/c/${parentCategorySlug}/${categorySlug}/${tagId}/l/${topicFilter}`;
} else if (this.noSubcategories) {
filter = `tags/c/${categorySlug}/none/${tagId}/l/${topicFilter}`;
} else {
filter = `tags/c/${categorySlug}/${tagId}/l/${topicFilter}`;
}
@ -162,7 +164,8 @@ export default DiscourseRoute.extend({
category: this.category,
filterMode: this.filterMode,
navMode: this.navMode,
tagNotification: this.tagNotification
tagNotification: this.tagNotification,
noSubcategories: this.noSubcategories
});
},