From 59241df25179023089d506b84e7f647452a4521e Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Tue, 5 Nov 2019 20:06:47 +0000 Subject: [PATCH] FIX: Display tags topic list correctly when none is selected for subcategories --- .../discourse/pre-initializers/dynamic-route-builders.js.es6 | 4 ++++ app/assets/javascripts/discourse/routes/app-route-map.js.es6 | 4 ++++ app/assets/javascripts/discourse/routes/tags-show.js.es6 | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/pre-initializers/dynamic-route-builders.js.es6 b/app/assets/javascripts/discourse/pre-initializers/dynamic-route-builders.js.es6 index a8de4fc07da..ecb018fe65e 100644 --- a/app/assets/javascripts/discourse/pre-initializers/dynamic-route-builders.js.es6 +++ b/app/assets/javascripts/discourse/pre-initializers/dynamic-route-builders.js.es6 @@ -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 }); diff --git a/app/assets/javascripts/discourse/routes/app-route-map.js.es6 b/app/assets/javascripts/discourse/routes/app-route-map.js.es6 index 2bc476425c5..1da84b40472 100644 --- a/app/assets/javascripts/discourse/routes/app-route-map.js.es6 +++ b/app/assets/javascripts/discourse/routes/app-route-map.js.es6 @@ -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 }); diff --git a/app/assets/javascripts/discourse/routes/tags-show.js.es6 b/app/assets/javascripts/discourse/routes/tags-show.js.es6 index 7bf26e26a9b..c718cc75ff1 100644 --- a/app/assets/javascripts/discourse/routes/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/tags-show.js.es6 @@ -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 }); },