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

View File

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

View File

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