2018-06-15 23:03:24 +08:00
|
|
|
import EmailLog from "admin/models/email-log";
|
2016-01-19 07:57:55 +08:00
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
2016-03-25 23:37:26 +08:00
|
|
|
loading: false,
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
loadMore() {
|
2018-06-15 23:03:24 +08:00
|
|
|
if (this.get("loading") || this.get("model.allLoaded")) {
|
|
|
|
return;
|
|
|
|
}
|
2016-03-25 23:37:26 +08:00
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
this.set("loading", true);
|
2016-03-25 23:37:26 +08:00
|
|
|
return EmailLog.findAll(this.get("filter"), this.get("model.length"))
|
2018-06-15 23:03:24 +08:00
|
|
|
.then(logs => {
|
|
|
|
if (logs.length < 50) {
|
|
|
|
this.get("model").set("allLoaded", true);
|
|
|
|
}
|
|
|
|
this.get("model").addObjects(logs);
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.set("loading", false);
|
|
|
|
});
|
2016-03-25 23:37:26 +08:00
|
|
|
}
|
2016-01-19 07:57:55 +08:00
|
|
|
}
|
|
|
|
});
|