update listing, collections and callbacks

This commit is contained in:
envoyr
2022-02-24 21:39:31 +01:00
parent 703e436b32
commit 5964c3b685
20 changed files with 544 additions and 372 deletions

View File

@@ -18,19 +18,30 @@
{% endif %}
{% endmacro %}
{% macro link(data) %}
{% apply spaceless %}
<a href="{{ data.href }}" {% if data.class is defined %}class="{{ data.class }}"{% endif %} {% if data.target is defined %}target="{{ data.target }}"{% endif %}>
{% if data.icon is defined %}
<i class="{{ data.icon }}"></i>
{% endif %}
{% if data.text is defined %}
{{ data.text }}
{% endif %}
</a>
{% endapply %}
{% endmacro %}
{% macro domainWithSan(data) %}
{{ data.domain }}
{% if data.san is not empty %}
<br /><span class="small">SAN: {{ data.san }}</span>
{% endif %}
{% endmacro %}
{% macro actions(data) %}
{% for action in data %}
{% if action.visible is not defined or action.visible is defined and action.visible %}
{% apply spaceless %}
<a href="{{ action.href }}" {% if action.target is defined %}target="{{ action.target }}"{% endif %}>
{% if action.icon is defined %}
<i class="{{ action.icon }}"></i>
{% endif %}
{% if action.text is defined %}
{{ action.text }}
{% endif %}
</a>
{% endapply %}
{{ _self.link(action) }}
{% endif %}
{% endfor %}
{% endmacro %}

View File

@@ -13,31 +13,35 @@
{% endif %}
<div class="card table-responsive">
<table class="table table-borderless table-striped mb-0">
<table class="table table-borderless table-striped table-sm mb-0 px-3">
<thead>
<tr>
{% for column in listing.table.th %}
<th class="p-3">{{ column }}</th>
{% for th in listing.table.th %}
<th class="p-3 {{ th.class }}">{{ th.text }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for td in listing.table.tr %}
<tr>
{% for value in td %}
<td class="p-3">
{% if value is iterable %}
{% if value.type == 'progressbar' %}
{{ callbacks.progressbar(value.data) }}
{% elseif value.type == 'boolean' %}
{{ callbacks.boolean(value.data) }}
{% elseif value.type == 'actions' %}
{{ callbacks.actions(value.data) }}
{% 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 == '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 '{{ value|json_encode }}' is not implemented!
Callback '{{ td|json_encode }}' is not implemented!
{% endif %}
{% else %}
{{ value|raw }}
{{ td.data|raw }}
{% endif %}
</td>
{% endfor %}
@@ -45,9 +49,11 @@
{% endfor %}
</tbody>
</table>
<div class="card-footer">
Pagination...
</div>
{% if listing.pagination is not empty %}
<div class="card-footer">
Pagination...
</div>
{% endif %}
</div>
</form>