2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
This controller supports the interface for dealing with flags in the admin section.
|
|
|
|
|
2013-03-15 06:03:13 +08:00
|
|
|
@class AdminFlagsController
|
2013-02-23 04:41:12 +08:00
|
|
|
@extends Ember.Controller
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-15 06:03:13 +08:00
|
|
|
**/
|
2014-07-23 11:20:45 +08:00
|
|
|
export default Ember.ArrayController.extend({
|
2013-03-15 06:03:13 +08:00
|
|
|
|
2014-08-05 04:48:04 +08:00
|
|
|
adminOldFlagsView: Em.computed.equal("query", "old"),
|
|
|
|
adminActiveFlagsView: Em.computed.equal("query", "active"),
|
2014-07-29 01:17:37 +08:00
|
|
|
|
2013-09-17 02:08:55 +08:00
|
|
|
actions: {
|
2013-02-23 04:41:12 +08:00
|
|
|
|
2014-07-29 01:17:37 +08:00
|
|
|
disagreeFlags: function (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"));
|
|
|
|
});
|
|
|
|
},
|
2013-06-20 15:42:15 +08:00
|
|
|
|
2014-07-29 01:17:37 +08:00
|
|
|
deferFlags: function (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"));
|
|
|
|
});
|
|
|
|
},
|
2013-06-21 05:20:08 +08:00
|
|
|
|
2014-02-06 06:54:16 +08:00
|
|
|
doneTopicFlags: function(item) {
|
2014-08-05 04:48:04 +08:00
|
|
|
this.send("disagreeFlags", item);
|
2014-02-06 06:54:16 +08:00
|
|
|
},
|
2013-07-27 03:40:08 +08:00
|
|
|
},
|
|
|
|
|
2013-08-19 19:14:26 +08:00
|
|
|
loadMore: function(){
|
2014-08-05 04:48:04 +08:00
|
|
|
var flags = this.get("model");
|
|
|
|
return Discourse.FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
|
2013-08-19 19:14:26 +08:00
|
|
|
if(data.length===0){
|
2014-08-05 04:48:04 +08:00
|
|
|
flags.set("allLoaded",true);
|
2013-08-19 19:14:26 +08:00
|
|
|
}
|
|
|
|
flags.addObjects(data);
|
|
|
|
});
|
|
|
|
}
|
2013-03-15 06:03:13 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|