mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 09:05:44 +08:00
FIX: add ability to show report data for all categories
This commit is contained in:
parent
67135a472a
commit
06dc63fbae
@ -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() {
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div>
|
||||
{{i18n 'admin.dashboard.reports.start_date'}} {{input type="date" value=startDate}}
|
||||
{{i18n 'admin.dashboard.reports.end_date'}} {{input type="date" value=endDate}}
|
||||
{{category-chooser valueAttribute="id" value=categoryId source=categoryId}}
|
||||
{{combo-box valueAttribute="value" content=categoryOptions value=categoryId}}
|
||||
{{d-button action="refreshReport" class="btn-primary" label="admin.dashboard.reports.refresh_report" icon="refresh"}}
|
||||
</div>
|
||||
|
||||
|
@ -1411,6 +1411,7 @@ en:
|
||||
category:
|
||||
can: 'can… '
|
||||
none: '(no category)'
|
||||
all: 'All categories'
|
||||
choose: 'Select a category…'
|
||||
edit: 'edit'
|
||||
edit_long: "Edit"
|
||||
|
Loading…
x
Reference in New Issue
Block a user