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
|
|
|
**/
|
2013-05-21 03:27:58 +08:00
|
|
|
Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
2013-03-15 06:03:13 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
Clear all flags on a post
|
|
|
|
|
|
|
|
@method clearFlags
|
|
|
|
@param {Discourse.FlaggedPost} item The post whose flags we want to clear
|
|
|
|
**/
|
|
|
|
clearFlags: function(item) {
|
|
|
|
var _this = this;
|
|
|
|
item.clearFlags().then((function() {
|
2013-05-21 03:27:58 +08:00
|
|
|
_this.removeObject(item);
|
|
|
|
}), function() {
|
2013-03-15 06:03:13 +08:00
|
|
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
2013-05-21 03:27:58 +08:00
|
|
|
});
|
2013-02-23 04:41:12 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes a post
|
|
|
|
|
|
|
|
@method deletePost
|
|
|
|
@param {Discourse.FlaggedPost} item The post to delete
|
|
|
|
**/
|
|
|
|
deletePost: function(item) {
|
|
|
|
var _this = this;
|
|
|
|
item.deletePost().then((function() {
|
2013-05-21 03:27:58 +08:00
|
|
|
_this.removeObject(item);
|
|
|
|
}), function() {
|
2013-03-15 06:03:13 +08:00
|
|
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
2013-05-21 03:27:58 +08:00
|
|
|
});
|
2013-02-23 04:41:12 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Are we viewing the 'old' view?
|
|
|
|
|
|
|
|
@property adminOldFlagsView
|
|
|
|
**/
|
|
|
|
adminOldFlagsView: (function() {
|
|
|
|
return this.query === 'old';
|
|
|
|
}).property('query'),
|
2013-02-21 02:15:50 +08:00
|
|
|
|
2013-02-22 01:58:21 +08:00
|
|
|
/**
|
2013-02-23 04:41:12 +08:00
|
|
|
Are we viewing the 'active' view?
|
|
|
|
|
|
|
|
@property adminActiveFlagsView
|
|
|
|
**/
|
|
|
|
adminActiveFlagsView: (function() {
|
|
|
|
return this.query === 'active';
|
|
|
|
}).property('query')
|
2013-03-15 06:03:13 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|