diff --git a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 index 0430e8a1809..1bf93fef7cb 100644 --- a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 @@ -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() { diff --git a/app/assets/javascripts/admin/templates/reports.hbs b/app/assets/javascripts/admin/templates/reports.hbs index 8a426de9317..c7383ef2c8a 100644 --- a/app/assets/javascripts/admin/templates/reports.hbs +++ b/app/assets/javascripts/admin/templates/reports.hbs @@ -3,7 +3,7 @@
{{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"}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index f84de9184b0..e637b4a17bb 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1411,6 +1411,7 @@ en: category: can: 'can… ' none: '(no category)' + all: 'All categories' choose: 'Select a category…' edit: 'edit' edit_long: "Edit"