From bab3e170e7fe991376706eacb69017c921a255ca Mon Sep 17 00:00:00 2001 From: Olimpia Magliulo <olimpiam@intern-ikts-MacBook-Air.local> Date: Tue, 7 Nov 2017 12:12:34 +0100 Subject: [PATCH] Add _table.twig the template can be used in different templates. It highlights rows differently if they're odd or even. It has 2 flexible blocks that can be used to override a column or add other content. Classes can be used to readapt it for a specific css framework. --- templates/_table.twig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 templates/_table.twig diff --git a/templates/_table.twig b/templates/_table.twig new file mode 100644 index 000000000..51ff32cc6 --- /dev/null +++ b/templates/_table.twig @@ -0,0 +1,23 @@ + +<table id="table_with_attributes" class="attributes" summary="attribute overview"> + +{% for name, values in items %} + <tr class="{{ cycle(['odd', 'even'], loop.index0) }}"> + {% block namecol %} + <td class="attrname">{{ name }}</td> + {% endblock %} + + <td class="attrvalue"> + {% for value in values %} + {% if loop.length>1 and loop.first %}<ul>{% endif %} + {% if loop.length>1 %}<li>{% endif %} + + {% block value %}{% endblock %} + + {% if loop.length>1 %}</li>{% endif %} + {% if loop.length>1 and loop.last %}</ul>{% endif %} + {% endfor %} + </td> + </tr> +{% endfor %} +</table><br> \ No newline at end of file -- GitLab