FIX: Build dynamic category / tag routes

This commit is contained in:
Robin Ward 2016-05-06 11:49:54 -04:00
parent 1625b08c86
commit f9fe9ac3ed
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
1 changed files with 11 additions and 1 deletions

View File

@ -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 });
});
}
};