This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/basic-topic-list.js.es6

36 lines
827 B
JavaScript

export default Ember.Component.extend({
loading: Ember.computed.not('loaded'),
loaded: function() {
var topicList = this.get('topicList');
if (topicList) {
return topicList.get('loaded');
} else {
return true;
}
}.property('topicList.loaded'),
_topicListChanged: function() {
this._initFromTopicList(this.get('topicList'));
}.observes('topicList.@each'),
_initFromTopicList: function(topicList) {
if (topicList !== null) {
this.set('topics', topicList.get('topics'));
this.rerender();
}
},
init: function() {
this._super();
var topicList = this.get('topicList');
if (topicList) {
this._initFromTopicList(topicList);
} else {
// Without a topic list, we assume it's loaded always.
this.set('loaded', true);
}
}
});