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

50 lines
1.2 KiB
Plaintext
Raw Normal View History

/**
This controller supports the interface for dealing with flags in the admin section.
@class AdminFlagsController
@extends Ember.Controller
@namespace Discourse
@module Discourse
**/
export default Ember.ArrayController.extend({
2014-08-04 16:48:04 -04:00
adminOldFlagsView: Em.computed.equal("query", "old"),
adminActiveFlagsView: Em.computed.equal("query", "active"),
2013-09-16 14:08:55 -04:00
actions: {
disagreeFlags: function (flaggedPost) {
var self = this;
flaggedPost.disagreeFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
2013-09-16 14:08:55 -04:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
deferFlags: function (flaggedPost) {
var self = this;
flaggedPost.deferFlags().then(function () {
self.removeObject(flaggedPost);
}, function () {
2013-09-16 14:08:55 -04:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
2014-02-05 17:54:16 -05:00
doneTopicFlags: function(item) {
2014-08-04 16:48:04 -04:00
this.send("disagreeFlags", item);
2014-02-05 17:54:16 -05:00
},
},
loadMore: function(){
2014-08-04 16:48:04 -04:00
var flags = this.get("model");
return Discourse.FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
if(data.length===0){
2014-08-04 16:48:04 -04:00
flags.set("allLoaded",true);
}
flags.addObjects(data);
});
}
});