From f9fe9ac3ed07f664a10bdbeab67b4e0519197791 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 6 May 2016 11:49:54 -0400 Subject: [PATCH] FIX: Build dynamic category / tag routes --- .../pre-initializers/dynamic-route-builders.js.es6 | 12 +++++++++++- 1 file changed, 11 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 57da82cbc91..f627573e73a 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 @@ -1,12 +1,13 @@ import buildCategoryRoute from 'discourse/routes/build-category-route'; import buildTopicRoute from 'discourse/routes/build-topic-route'; import DiscoverySortableController from 'discourse/controllers/discovery-sortable'; +import TagsShowRoute from 'discourse/routes/tags-show'; export default { after: 'inject-discourse-objects', name: 'dynamic-route-builders', - initialize(container, app) { + initialize(registry, app) { app.DiscoveryCategoryController = DiscoverySortableController.extend(); app.DiscoveryParentCategoryController = DiscoverySortableController.extend(); app.DiscoveryCategoryNoneController = DiscoverySortableController.extend(); @@ -58,5 +59,14 @@ export default { app[`DiscoveryTop${periodCapitalized}ParentCategoryRoute`] = buildCategoryRoute('top/' + period); app[`DiscoveryTop${periodCapitalized}CategoryNoneRoute`] = buildCategoryRoute('top/' + period, {no_subcategories: true}); }); + + app["TagsShowCategoryRoute"] = TagsShowRoute.extend(); + app["TagsShowParentCategoryRoute"] = TagsShowRoute.extend(); + + site.get('filters').forEach(function(filter) { + app["TagsShow" + filter.capitalize() + "Route"] = TagsShowRoute.extend({ filterMode: filter }); + app["TagsShowCategory" + filter.capitalize() + "Route"] = TagsShowRoute.extend({ filterMode: filter }); + app["TagsShowParentCategory" + filter.capitalize() + "Route"] = TagsShowRoute.extend({ filterMode: filter }); + }); } };