Add filter by action to staff logs page

This commit is contained in:
Neil Lalonde
2013-08-09 10:06:02 -04:00
parent 33bddbff85
commit 90a3bcf6ff
9 changed files with 68 additions and 24 deletions

View File

@@ -8,11 +8,12 @@
**/
Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Discourse.Presence, {
loading: false,
filters: null,
show: function() {
show: function(filters) {
var self = this;
this.set('loading', true);
Discourse.StaffActionLog.findAll().then(function(result) {
Discourse.StaffActionLog.findAll(this.get('filters')).then(function(result) {
self.set('content', result);
self.set('loading', false);
});
@@ -20,5 +21,23 @@ Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Disc
toggleFullDetails: function(target) {
target.set('showFullDetails', !target.get('showFullDetails'));
},
clearFiltersClass: function() {
if (this.get('filters') === null) {
return 'invisible';
} else {
return '';
}
}.property('filters'),
clearFilters: function() {
this.set('filters', null);
this.show();
},
filterByAction: function(action) {
this.set('filters', {action_name: action});
this.show();
}
});