discourse/app/assets/javascripts/admin/controllers/admin-email-incomings.js.es6

22 lines
662 B
Text
Raw Normal View History

import IncomingEmail from 'admin/models/incoming-email';
export default Ember.Controller.extend({
2016-03-25 11:37:26 -04:00
loading: false,
actions: {
loadMore() {
if (this.get("loading") || this.get("model.allLoaded")) { return; }
this.set('loading', true);
IncomingEmail.findAll(this.get("filter"), this.get("model.length"))
.then(incoming => {
if (incoming.length < 50) { this.get("model").set("allLoaded", true); }
this.get("model").addObjects(incoming);
}).finally(() => {
this.set('loading', false);
});
}
}
});