Skip to content

Commit

Permalink
refs #1816 it is a bit better readable this way, need to create a tra…
Browse files Browse the repository at this point in the history
…nslation
  • Loading branch information
tsteur committed Nov 20, 2013
1 parent bb0e02d commit c6240e6
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions plugins/CoreHome/templates/_dataTableCell.twig
Expand Up @@ -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 }}">&nbsp;{{ rowPercentage }}</span>
<span class="ratio" title="{{ firstPartOfTooltip|e('html_attr') }} {{ secondPartOfTooltip|e('html_attr') }}">&nbsp;{{ rowPercentage }}</span>
{%- endif %}
{% endspaceless %}

0 comments on commit c6240e6

Please sign in to comment.