FEATURE: differentiate total and total for period on admin table report

This commit is contained in:
Joffrey JAFFEUX 2018-06-21 22:46:53 +02:00 committed by GitHub
parent c2ddad696f
commit fed86225c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View File

@ -0,0 +1,9 @@
import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
@computed("model.sortedData")
totalForPeriod(data) {
const values = data.map(d => d.y);
return values.reduce((sum, v) => sum + v);
}
});

View File

@ -14,11 +14,20 @@
</tr>
{{/each}}
{{#if model.total}}
<tr class="total-for-period">
<td class="x-value">
{{i18n 'admin.dashboard.reports.total_for_period'}}
</td>
<td>
{{totalForPeriod}}
</td>
</tr>
{{#if model.total}}
<tr class="total">
<td class="x-value">
{{i18n 'admin.dashboard.reports.total'}}
</td>
<td>
{{model.total}}
</td>

View File

@ -178,7 +178,8 @@ $mobile-breakpoint: 700px;
}
}
tr.total-for-period {
tr.total-for-period,
tr.total {
td {
font-weight: 700;
}

View File

@ -2775,6 +2775,7 @@ en:
groups: "All groups"
disabled: "This report is disabled"
total_for_period: "Total for period"
total: "Total"
trending_search:
more: '<a href="/admin/logs/search_logs">Search logs</a>'
disabled: 'Trending search report is disabled. Enable <a href="/admin/site_settings/category/all_results?filter=log%20search%20queries">log search queries</a> to collect data.'