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/controllers/discovery/top.js.es6

30 lines
745 B
JavaScript

import DiscoveryController from 'discourse/controllers/discovery';
export default DiscoveryController.extend({
needs: ['discovery'],
period: function() {
return this.get('controllers.discovery.periods').findBy('id', this.get('periodId'));
}.property('periodId'),
topicList: function() {
return this.get('model.' + this.get('periodId'));
}.property('periodId'),
actions: {
refresh: function() {
var self = this;
// Don't refresh if we're still loading
if (this.get('controllers.discovery.loading')) { return; }
this.send('loading');
Discourse.TopList.find().then(function(top_lists) {
self.set('model', top_lists);
self.send('loadingComplete');
});
}
}
});