diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2013-11-20 08:40:39 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2013-11-20 08:40:39 +0400 |
commit | c6240e6cfc071d8f051025c9e015d827fdf99cfc (patch) | |
tree | 0fe71f25af43e44aca6c8cf1b8928d8e49f2a385 /plugins/CoreHome/templates/_dataTableCell.twig | |
parent | bb0e02d21541125eca23ba0256b3a3cde3db262c (diff) |
refs #1816 it is a bit better readable this way, need to create a translation
Diffstat (limited to 'plugins/CoreHome/templates/_dataTableCell.twig')
-rw-r--r-- | plugins/CoreHome/templates/_dataTableCell.twig | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/plugins/CoreHome/templates/_dataTableCell.twig b/plugins/CoreHome/templates/_dataTableCell.twig index a5d21d105d..3ef2e8803f 100644 --- a/plugins/CoreHome/templates/_dataTableCell.twig +++ b/plugins/CoreHome/templates/_dataTableCell.twig @@ -20,17 +20,23 @@ </a> {% endif %} {% if row.getMetadata(tooltipIndex) %}</span>{% endif %} - {% set totals = dataTable.getMetadata('totals') %} + +{% set totals = dataTable.getMetadata('totals') %} {% if column in totals|keys -%} - {% set rowPercentage = row.getColumn(column)|percentage(totals[column], 1) %} - {% set totalValue = siteSummary.getFirstRow.getColumn(column) %} + {% set labelColumn = columns_to_display|first %} + {% set reportTotal = totals[column] %} + {% set siteTotal = siteSummary.getFirstRow.getColumn(column) %} + {% set rowPercentage = row.getColumn(column)|percentage(reportTotal, 1) %} + + {% set firstPartOfTooltip = ["'", row.getColumn(labelColumn), "' represents ", rowPercentage, ' of ', reportTotal, ' ', translations[column]|default(column), ' with ', translations[labelColumn]|default(labelColumn), '.']|join %} - {% if totalValue %} - {% set totalPercentage = row.getColumn(column)|percentage(totalValue, 1) %} - {% set secondPartOfTooltip = ['This is ', totalPercentage, ' of all ', totalValue, ' ', translations[column]|default(column)]|join %} + {% if siteTotal and siteTotal != reportTotal %} + {% set totalPercentage = row.getColumn(column)|percentage(siteTotal, 1) %} + {% set secondPartOfTooltip = ['This is ', totalPercentage, ' of all ', siteTotal, ' ', translations[column]|default(column), '.']|join %} {% else %} {% set secondPartOfTooltip = '' %} + {% endif %} - <span class="ratio" title="'{{ row.getColumn(columns_to_display|first)|e('html_attr') }}' represents {{ rowPercentage|e('html_attr') }} of {{ totals[column]|e('html_attr') }} with {{ translations[columns_to_display|first]|default(columns_to_display|first)|e('html_attr') }}. {{ secondPartOfTooltip }}"> {{ rowPercentage }}</span> + <span class="ratio" title="{{ firstPartOfTooltip|e('html_attr') }} {{ secondPartOfTooltip|e('html_attr') }}"> {{ rowPercentage }}</span> {%- endif %} {% endspaceless %} |