diff options
Diffstat (limited to 'plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig')
-rw-r--r-- | plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig index 38c2101168..a9ac3f4dae 100644 --- a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig +++ b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig @@ -19,11 +19,13 @@ </tr> {% endif %} {% else %} + {% set rowIndex = properties.filter_offset|default(0) + 1 %} {%- for rowId, row in dataTable.getRows() -%} {%- set rowHasSubtable = not subtablesAreDisabled and row.getIdSubDataTable() and properties.subtable_controller_action is not null -%} {%- set rowSubtableId = row.getMetadata('idsubdatatable_in_db')|default(row.getIdSubDataTable()) -%} {%- set isSummaryRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') or row.getMetadata('is_summary') -%} {%- set shouldHighlightRow = isSummaryRow and properties.highlight_summary_row -%} + {% set dimensions = dataTable.getMetadata('dimensions')|default([]) %} {# display this row if it doesn't have a subtable or if we don't replace the row with the subtable #} {%- set showRow = subtablesAreDisabled @@ -36,21 +38,38 @@ {% if row.getMetadata('segment') is not false %} data-segment-filter="{{ row.getMetadata('segment')|e('html_attr') }}"{% endif %} {% if row.getMetadata('url') is not false %} data-url-label="{{ row.getMetadata('url')|rawSafeDecoded }}"{% endif %} data-row-metadata="{{ row.getMetadata|json_encode|e('html_attr') }}" - class="{{ row.getMetadata('css_class') }} {% if rowHasSubtable %}subDataTable{% endif %}{% if shouldHighlightRow %} highlight{% endif %}{% if isSummaryRow %} summaryRow{% endif %}" + class="{{ row.getMetadata('css_class') }} {% if rowHasSubtable %}subDataTable{% endif %}{% if shouldHighlightRow %} highlight{% endif %}{% if isSummaryRow %} summaryRow{% endif %} {% if isComparing %}parentComparisonRow{% endif %}" {% if rowHasSubtable %}title="{{ 'CoreHome_ClickRowToExpandOrContract'|translate }}"{% endif %}> {% for column in properties.columns_to_display %} {% set cellAttributes = visualization.getCellHtmlAttributes(row, column) %} - <td {% if cellAttributes is not empty %}{% for name, value in cellAttributes %}{{ name|e('html') }}="{{ value|e('html_attr') }}" {% endfor %}{% endif %}> + <td class="{% if column =='label' or column in dimensions %}label{% else %}column{% endif %} {{ cellAttributes.class|default|e('html_attr') }}" + {% if cellAttributes is not empty %}{% for name, value in cellAttributes %}{{ name|e('html') }}="{{ value|e('html_attr') }}" {% endfor %}{% endif %} + > + {% if isComparing and column == 'label' %} + <span class="prefix-numeral">{{ rowIndex }}.</span> + {% endif %} + {% include "@CoreHome/_dataTableCell.twig" with properties %} </td> {% endfor %} </tr> + + {% if row.getComparisons() %} + {% include "@CoreVisualizations/_dataTableViz_htmlTable_comparisons.twig" with { + 'comparedRow': row, + 'dataTable': row.getComparisons(), + 'rootDataTable': dataTable, + 'dimensions': dimensions, + } %} + {% endif %} {% endif %} {# display subtable if present and showing expanded datatable #} {% if properties.show_expanded|default(false) and rowHasSubtable %} {% include "@CoreVisualizations/_dataTableViz_htmlTable.twig" with {'dataTable': row.getSubtable(), 'idSubtable': rowSubtableId} %} {% endif %} + + {% set rowIndex = rowIndex + 1 %} {%- endfor -%} {% if dataTable.getTotalsRow and properties.show_totals_row %} {% set row = dataTable.getTotalsRow %} @@ -58,7 +77,7 @@ <tr class="{{ row.getMetadata('css_class') }} totalsRow" title="Total values for this table"> {% for column in properties.columns_to_display %} - <td> + <td class="{% if column =='label' %}label{% else %}column{% endif %}"> {% include "@CoreHome/_dataTableCell.twig" with properties %} </td> {% endfor %} |