Skip to content

Commit

Permalink
Merge pull request #6 from Pitoune/feat/display-multidimensional-array
Browse files Browse the repository at this point in the history
Display multidimensional arrays
  • Loading branch information
Pierre Ducoudray authored Jun 6, 2017
2 parents ba3ee7f + a299207 commit 16ea3f0
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions Resources/views/Table/macros.html.twig
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
{% macro list(labels, fields, values) %}

{% import 'SyliusResourceBundle:Macros:buttons.html.twig' as buttons %}
{% import 'SyliusResourceBundle:Macros:buttons.html.twig' as buttons %}

{% if values|length > 0 %}
<table id="results" class="ui sortable stackable celled table">
<thead>
{% if values|length > 0 %}
<table id="results" class="ui sortable stackable celled table"
{% if values|first is iterable %}style="display: block; overflow-x: auto;"{% endif %}>
<thead>
<tr>
<th></th>
{% for label in labels %}
<th>{{ label }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
</thead>
<tbody>
{% for key,value in values %}
<tr id="{{ loop.index }}">
<td>{{ loop.index }}</td>
<td>{{ key }}</td>
<td>{{ value }}</td>
{% if value is iterable %}
{% for item in value %}
<td>{{ item }}</td>
{% endfor %}
{% else %}
<td>{{ key }}</td>
<td>{{ value }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<span>{{ 'sylius.ui.there_are_no_reports_created'|trans }}</span>
{% endif %}

</tbody>
</table>
{% else %}
<span>{{ 'sylius.ui.there_are_no_reports_created'|trans }}</span>
{% endif %}
{% endmacro %}

0 comments on commit 16ea3f0

Please sign in to comment.