mirror of
https://github.com/flarum/framework.git
synced 2024-12-15 16:53:37 +08:00
36 lines
684 B
JavaScript
36 lines
684 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Route.extend({
|
|
|
|
setupController: function(controller, model) {
|
|
controller.set('model', model);
|
|
|
|
if ( ! model.get('length')) {
|
|
controller.set('resultsLoading', true);
|
|
|
|
controller.getResults().then(function(results) {
|
|
controller
|
|
.set('resultsLoading', false)
|
|
.set('meta', results.get('meta'))
|
|
.set('model.content', results);
|
|
});
|
|
}
|
|
},
|
|
|
|
model: function() {
|
|
var model = Ember.ArrayProxy.create();
|
|
|
|
return Ember.RSVP.resolve(model);
|
|
},
|
|
|
|
actions: {
|
|
queryParamsDidChange: function() {
|
|
var self = this;
|
|
Ember.run.scheduleOnce('afterRender', function() {
|
|
self.refresh();
|
|
});
|
|
}
|
|
}
|
|
|
|
});
|