move html from callbacks to twig
This commit is contained in:
19
templates/Froxlor/table/callbacks.html.twig
Normal file
19
templates/Froxlor/table/callbacks.html.twig
Normal file
@@ -0,0 +1,19 @@
|
||||
{% macro progressbar(data) %}
|
||||
<div class="progress progress-thin">
|
||||
<div class="progress-bar {{ data.style }}" style="width: {{ data.percent }}%;"></div>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
{% if data.infotext is not empty %}
|
||||
<i class="fa-solid fa-circle-info" data-toggle="tooltip" data-placement="right" title="{{ data.infotext|raw }}"></i>
|
||||
{% endif %}
|
||||
{{ data.text }}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro boolean(data) %}
|
||||
{% if (data) %}
|
||||
<i class="fa fa-check-circle"></i>
|
||||
{% else %}
|
||||
<i class="fa fa-times-circle"></i>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
@@ -1,5 +1,7 @@
|
||||
{% 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">
|
||||
@@ -24,7 +26,17 @@
|
||||
<tr>
|
||||
{% for value in td %}
|
||||
<td class="p-3">
|
||||
{{ value|raw }}
|
||||
{% if value is iterable %}
|
||||
{% if value.type == 'progressbar' %}
|
||||
{{ callbacks.progressbar(value.data) }}
|
||||
{% elseif value.type == 'boolean' %}
|
||||
{{ callbacks.boolean(value.data) }}
|
||||
{% else %}
|
||||
Callback '{{ value|json_encode }}' is not implemented!
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ value|raw }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user