missed the CategoryList constant

This commit is contained in:
Régis Hanol 2015-11-26 23:44:15 +01:00
parent 4a25d55e9f
commit c8c6034a7a
2 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,6 @@ export default DiscoveryController.extend({
actions: { actions: {
refresh() { refresh() {
// Don't refresh if we're still loading // Don't refresh if we're still loading
if (this.get('controllers.discovery.loading')) { return; } if (this.get('controllers.discovery.loading')) { return; }
@ -21,9 +20,10 @@ export default DiscoveryController.extend({
// Lesson learned: Don't call `loading` yourself. // Lesson learned: Don't call `loading` yourself.
this.set('controllers.discovery.loading', true); this.set('controllers.discovery.loading', true);
const CategoryList = require('discourse/models/category-list').default;
const parentCategory = this.get('model.parentCategory'); const parentCategory = this.get('model.parentCategory');
const promise = parentCategory ? Discourse.CategoryList.listForParent(this.store, parentCategory) : const promise = parentCategory ? CategoryList.listForParent(this.store, parentCategory) :
Discourse.CategoryList.list(this.store); CategoryList.list(this.store);
const self = this; const self = this;
promise.then(function(list) { promise.then(function(list) {
@ -38,7 +38,7 @@ export default DiscoveryController.extend({
}.property(), }.property(),
latestTopicOnly: function() { latestTopicOnly: function() {
return this.get('model.categories').find(function(c) { return c.get('featuredTopics.length') > 1; }) === undefined; return this.get('model.categories').find(c => c.get('featuredTopics.length') > 1) === undefined;
}.property('model.categories.@each.featuredTopics.length') }.property('model.categories.@each.featuredTopics.length')
}); });

View File

@ -37,8 +37,8 @@ export default (filter, params) => {
_createSubcategoryList(category) { _createSubcategoryList(category) {
this._categoryList = null; this._categoryList = null;
if (Em.isNone(category.get('parentCategory')) && Discourse.SiteSettings.show_subcategory_list) { if (Em.isNone(category.get('parentCategory')) && Discourse.SiteSettings.show_subcategory_list) {
return Discourse.CategoryList.listForParent(this.store, category) const CategoryList = require('discourse/models/category-list').default;
.then(list => this._categoryList = list); return CategoryList.listForParent(this.store, category).then(list => this._categoryList = list);
} }
// If we're not loading a subcategory list just resolve // If we're not loading a subcategory list just resolve