diff options
Diffstat (limited to 'plugins/CoreHome/templates/_dataTableCell.twig')
-rw-r--r-- | plugins/CoreHome/templates/_dataTableCell.twig | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/plugins/CoreHome/templates/_dataTableCell.twig b/plugins/CoreHome/templates/_dataTableCell.twig index 7aca38defd..7c72b57385 100644 --- a/plugins/CoreHome/templates/_dataTableCell.twig +++ b/plugins/CoreHome/templates/_dataTableCell.twig @@ -12,31 +12,14 @@ {% endif %} {% set totals = dataTable.getMetadata('totals') %} -{% if column in properties.report_ratio_columns and column in totals|keys -%} - {% set labelColumn = columns_to_display|first %} - {% set reportTotal = totals[column] %} - {% if siteSummary is defined and siteSummary is not empty and siteSummary.getFirstRow %} - {% set siteTotal = siteSummary.getFirstRow.getColumn(column) %} - {% else %} - {% set siteTotal = 0 %} - {% endif %} - {% set rowPercentage = row.getColumn(column)|percentage(reportTotal, 1) %} - {% set metricTitle = translations[column]|default(column) %} - {% set reportLabel = row.getColumn(labelColumn)|truncate(40)|rawSafeDecoded %} - - {% set reportRatioTooltip = 'General_ReportRatioTooltip'|translate(reportLabel, rowPercentage|e('html_attr'), reportTotal|e('html_attr'), metricTitle|e('html_attr'), translations[labelColumn]|default(labelColumn)|e('html_attr')) %} - - {% if siteTotal and siteTotal > reportTotal %} - {% set totalPercentage = row.getColumn(column)|percentage(siteTotal, 1) %} - {% set totalRatioTooltip = 'General_TotalRatioTooltip'|translate(totalPercentage, siteTotal|number(2,0), metricTitle) %} - {% else %} - {% set totalRatioTooltip = '' %} - {% endif %} +{% set labelColumn = columns_to_display|first %} +{% set reportLabel = row.getColumn(labelColumn)|truncate(40)|rawSafeDecoded %} +{% include "@CoreVisualizations/_dataTableViz_htmlTable_ratio.twig" with { + 'label': reportLabel, + 'labelColumn': labelColumn, + 'translations': properties.translations +} %} - <span class="ratio" - title="{{ reportRatioTooltip|raw }} {{ totalRatioTooltip|e('html_attr') }}" - > {{ rowPercentage }}</span> -{%- endif %} {% set dimensions = dataTable.getMetadata('dimensions')|default([]) %} {% if column=='label' or column in dimensions %} {% import 'macros.twig' as piwik %} |