mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: add ability to show report data for all categories
This commit is contained in:
parent
67135a472a
commit
06dc63fbae
3 changed files with 14 additions and 8 deletions
|
@ -7,16 +7,21 @@ export default Ember.ObjectController.extend({
|
|||
categoryId: null,
|
||||
refreshing: false,
|
||||
|
||||
categoryOptions: function() {
|
||||
var arr = [{name: I18n.t('category.all'), value: 'all'}];
|
||||
return arr.concat( Discourse.Site.currentProp('sortedCategories').map(function(i) { return {name: i.get('name'), value: i.get('id') }; }) );
|
||||
}.property(),
|
||||
|
||||
actions: {
|
||||
refreshReport() {
|
||||
var q;
|
||||
this.set("refreshing", true);
|
||||
Discourse.Report.find(
|
||||
this.get("type"),
|
||||
this.get("startDate"),
|
||||
this.get("endDate"),
|
||||
this.get("categoryId")
|
||||
).then(m => this.set("model", m)
|
||||
).finally(() => this.set("refreshing", false));
|
||||
if (this.get('categoryId') === "all") {
|
||||
q = Discourse.Report.find(this.get("model.type"), this.get("startDate"), this.get("endDate"));
|
||||
} else {
|
||||
q = Discourse.Report.find(this.get("model.type"), this.get("startDate"), this.get("endDate"), this.get("categoryId"));
|
||||
}
|
||||
q.then(m => this.set("model", m)).finally(() => this.set("refreshing", false));
|
||||
},
|
||||
|
||||
viewAsTable() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue