63 lines
1.9 KiB
Twig
63 lines
1.9 KiB
Twig
{% macro table(listing) %}
|
|
|
|
{% import "Froxlor/table/callbacks.html.twig" as callbacks %}
|
|
|
|
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
|
|
{% if listing.title is not empty %}
|
|
<h3 class="page-header">
|
|
{% if listing.icon is not empty %}
|
|
<i class="{{ listing.icon }}"></i>
|
|
{% endif %}
|
|
{{ listing.title }}
|
|
</h3>
|
|
{% endif %}
|
|
|
|
<div class="card table-responsive">
|
|
<table class="table table-borderless table-striped table-sm mb-0 px-3">
|
|
<thead>
|
|
<tr>
|
|
{% for th in listing.table.th %}
|
|
<th class="p-3 {{ th.class }}">{{ th.text }}</th>
|
|
{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for tr in listing.table.tr %}
|
|
<tr {% if tr.class is defined %}class="{{ tr.class }}"{% endif %}>
|
|
{% for td in tr.td %}
|
|
<td class="px-3{% if td.class is defined %} {{ td.class }}{% endif %}">
|
|
{% if td.data is iterable %}
|
|
{% if td.data.type == 'progressbar' %}
|
|
{{ callbacks.progressbar(td.data.data) }}
|
|
{% elseif td.data.type == 'boolean' %}
|
|
{{ callbacks.boolean(td.data.data) }}
|
|
{% elseif td.data.type == 'booleanWithInfo' %}
|
|
{{ callbacks.booleanWithInfo(td.data.data) }}
|
|
{% elseif td.data.type == 'link' %}
|
|
{{ callbacks.link(td.data.data) }}
|
|
{% elseif td.data.type == 'domainWithSan' %}
|
|
{{ callbacks.domainWithSan(td.data.data) }}
|
|
{% elseif td.data.type == 'actions' %}
|
|
{{ callbacks.actions(td.data.data) }}
|
|
{% else %}
|
|
Callback '{{ td|json_encode }}' is not implemented!
|
|
{% endif %}
|
|
{% else %}
|
|
{{ td.data|raw }}
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% if listing.pagination is not empty %}
|
|
<div class="card-footer">
|
|
Pagination...
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
|
|
{% endmacro %}
|