2013-02-22 15:41:12 -05:00
|
|
|
/**
|
|
|
|
This controller supports the interface for dealing with flags in the admin section.
|
|
|
|
|
2013-03-14 18:03:13 -04:00
|
|
|
@class AdminFlagsController
|
2013-02-22 15:41:12 -05:00
|
|
|
@extends Ember.Controller
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
2013-03-14 18:03:13 -04:00
|
|
|
**/
|
2013-05-20 15:27:58 -04:00
|
|
|
Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
2013-03-14 18:03:13 -04:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
/**
|
|
|
|
Clear all flags on a post
|
|
|
|
|
|
|
|
@method clearFlags
|
|
|
|
@param {Discourse.FlaggedPost} item The post whose flags we want to clear
|
|
|
|
**/
|
|
|
|
clearFlags: function(item) {
|
2013-05-24 16:03:20 -04:00
|
|
|
var adminFlagsController = this;
|
2013-02-22 15:41:12 -05:00
|
|
|
item.clearFlags().then((function() {
|
2013-05-24 16:03:20 -04:00
|
|
|
adminFlagsController.removeObject(item);
|
2013-05-20 15:27:58 -04:00
|
|
|
}), function() {
|
2013-03-14 18:03:13 -04:00
|
|
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
2013-05-20 15:27:58 -04:00
|
|
|
});
|
2013-02-22 15:41:12 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes a post
|
|
|
|
|
|
|
|
@method deletePost
|
|
|
|
@param {Discourse.FlaggedPost} item The post to delete
|
|
|
|
**/
|
|
|
|
deletePost: function(item) {
|
2013-05-24 16:03:20 -04:00
|
|
|
var adminFlagsController = this;
|
2013-02-22 15:41:12 -05:00
|
|
|
item.deletePost().then((function() {
|
2013-05-24 16:03:20 -04:00
|
|
|
adminFlagsController.removeObject(item);
|
2013-05-20 15:27:58 -04:00
|
|
|
}), function() {
|
2013-03-14 18:03:13 -04:00
|
|
|
bootbox.alert(Em.String.i18n("admin.flags.error"));
|
2013-05-20 15:27:58 -04:00
|
|
|
});
|
2013-02-22 15:41:12 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Are we viewing the 'old' view?
|
|
|
|
|
|
|
|
@property adminOldFlagsView
|
|
|
|
**/
|
2013-05-24 16:03:20 -04:00
|
|
|
adminOldFlagsView: Em.computed.equal('query', 'old'),
|
2013-02-20 13:15:50 -05:00
|
|
|
|
2013-02-21 12:58:21 -05:00
|
|
|
/**
|
2013-02-22 15:41:12 -05:00
|
|
|
Are we viewing the 'active' view?
|
|
|
|
|
|
|
|
@property adminActiveFlagsView
|
|
|
|
**/
|
2013-05-24 16:03:20 -04:00
|
|
|
adminActiveFlagsView: Em.computed.equal('query', 'active')
|
2013-03-14 18:03:13 -04:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|