mirror of
https://github.com/discourse/discourse.git
synced 2025-02-09 04:44:59 +00:00
FIX: Triggering a refresh while subcategory lists was broken.
It would then list all categories isntead of the subcategory you were viewing at that time.
This commit is contained in:
parent
b4e5937850
commit
6c4c542ae3
@ -8,7 +8,6 @@ export default DiscoveryController.extend({
|
||||
|
||||
actions: {
|
||||
refresh: function() {
|
||||
var self = this;
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
@ -17,7 +16,17 @@ export default DiscoveryController.extend({
|
||||
// router and ember throws an error due to missing `handlerInfos`.
|
||||
// Lesson learned: Don't call `loading` yourself.
|
||||
this.set('controllers.discovery.loading', true);
|
||||
Discourse.CategoryList.list('categories').then(function(list) {
|
||||
|
||||
var parentCategory = this.get('model.parentCategory');
|
||||
var promise;
|
||||
if (parentCategory) {
|
||||
promise = Discourse.CategoryList.listForParent(parentCategory);
|
||||
} else {
|
||||
promise = Discourse.CategoryList.list();
|
||||
}
|
||||
|
||||
var self = this;
|
||||
promise.then(function(list) {
|
||||
self.set('model', list);
|
||||
self.send('loadingComplete');
|
||||
});
|
||||
|
@ -1,11 +1,3 @@
|
||||
/**
|
||||
A data model for containing a list of categories
|
||||
|
||||
@class CategoryList
|
||||
@extends Discourse.Model
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.CategoryList = Ember.ArrayProxy.extend({
|
||||
init: function() {
|
||||
this.set('content', []);
|
||||
@ -50,7 +42,8 @@ Discourse.CategoryList.reopenClass({
|
||||
var self = this;
|
||||
return Discourse.ajax('/categories.json?parent_category_id=' + category.get('id')).then(function(result) {
|
||||
return Discourse.CategoryList.create({
|
||||
categories: self.categoriesFrom(result)
|
||||
categories: self.categoriesFrom(result),
|
||||
parentCategory: category
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
{{#if selected}}
|
||||
<div id='bulk-select'>
|
||||
<button class='btn no-text' {{action "showBulkActions"}}><i class="fa fa-wrench"></i></button>
|
||||
{{d-button action="showBulkActions" icon="wrench" class="no-text"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user