discourse/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6

44 lines
1.1 KiB
Plaintext
Raw Normal View History

import FlaggedPost from 'admin/models/flagged-post';
export default Ember.ArrayController.extend({
query: null,
2014-08-05 04:48:04 +08:00
adminOldFlagsView: Em.computed.equal("query", "old"),
adminActiveFlagsView: Em.computed.equal("query", "active"),
2013-09-17 02:08:55 +08:00
actions: {
2015-02-19 03:21:36 +08:00
disagreeFlags(flaggedPost) {
var self = this;
flaggedPost.disagreeFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
2013-09-17 02:08:55 +08:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
2015-02-19 03:21:36 +08:00
deferFlags(flaggedPost) {
var self = this;
flaggedPost.deferFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
2013-09-17 02:08:55 +08:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
2015-02-19 03:21:36 +08:00
doneTopicFlags(item) {
2014-08-05 04:48:04 +08:00
this.send("disagreeFlags", item);
2014-02-06 06:54:16 +08:00
},
loadMore(){
const flags = this.get('model');
return FlaggedPost.findAll(this.get('query'), flags.length+1).then(data => {
if (data.length===0) {
flags.set("allLoaded",true);
}
flags.addObjects(data);
});
}
}
});