discourse/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6
Sam c0b277d273 REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS
This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821

Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
2015-11-21 00:14:50 +11:00

44 lines
1.0 KiB
JavaScript

import FlaggedPost from 'admin/models/flagged-post';
export default Ember.ArrayController.extend({
query: null,
adminOldFlagsView: Em.computed.equal("query", "old"),
adminActiveFlagsView: Em.computed.equal("query", "active"),
actions: {
disagreeFlags(flaggedPost) {
var self = this;
flaggedPost.disagreeFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
bootbox.alert(I18n.t("admin.flags.error"));
});
},
deferFlags(flaggedPost) {
var self = this;
flaggedPost.deferFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
bootbox.alert(I18n.t("admin.flags.error"));
});
},
doneTopicFlags(item) {
this.send("disagreeFlags", item);
},
},
loadMore(){
var flags = this.get("model");
return FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
if(data.length===0){
flags.set("allLoaded",true);
}
flags.addObjects(data);
});
}
});