update crud templates

This commit is contained in:
Simon Vieille 2021-05-27 21:34:01 +02:00
parent 4764aefb39
commit 6dc3465084
2 changed files with 37 additions and 35 deletions

View file

@ -157,4 +157,4 @@
"Tasks": "Tâches" "Tasks": "Tâches"
"Results": "Résultats" "Results": "Résultats"
"Clean all cache": "Nettoyer tout le cache" "Clean all cache": "Nettoyer tout le cache"
"You can sort items by drag & drop": "Vous pouvez trier les élements via un glisser/déposer" "You can sort items with drag & drop": "Vous pouvez trier les élements via un glisser/déposer"

View file

@ -84,48 +84,50 @@
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
{% for label, config in configuration.fields(context) %} {% for label, config in configuration.fields(context) %}
{% set attr = config.options.attr is defined ? config.options.attr : [] %} {% block list_header_item %}
{% set isSortable = config.options.sort ?? false %} {% set attr = config.options.attr is defined ? config.options.attr : [] %}
{% set isSortable = config.options.sort ?? false %}
<th {% for key, value in attr %}{{ key }}="{{ value }}"{% endfor %}> <th {% for key, value in attr %}{{ key }}="{{ value }}"{% endfor %}>
{% if isSortable %} {% if isSortable %}
{% if sort %} {% if sort %}
{% if sort.label == label %} {% if sort.label == label %}
{% if sort.direction == 'asc' %} {% if sort.direction == 'asc' %}
{% set newDirection = 'desc' %} {% set newDirection = 'desc' %}
{% set icon = 'fa fa-sort-amount-down-alt' %} {% set icon = 'fa fa-sort-amount-down-alt' %}
{% else %}
{% set newDirection = 'asc' %}
{% set icon = 'fa fa-sort-amount-up-alt' %}
{% endif %}
{% set url = path(configuration.getPageRoute(context), {
_sort: config.options.sort[0],
_sort_direction: newDirection,
}) %}
{% else %} {% else %}
{% set newDirection = 'asc' %} {% set url = path(configuration.getPageRoute(context), {
{% set icon = 'fa fa-sort-amount-up-alt' %} _sort: config.options.sort[0],
_sort_direction: 'asc',
}) %}
{% set icon = null %}
{% endif %} {% endif %}
{% set url = path(configuration.getPageRoute(context), { <a href="{{ url }}">
_sort: config.options.sort[0], {% if icon is defined %}
_sort_direction: newDirection, <span class="{{ icon }}"></span>
}) %} {% endif %}
{{ label|trans }}
</a>
{% else %} {% else %}
{% set url = path(configuration.getPageRoute(context), {
_sort: config.options.sort[0],
_sort_direction: 'asc',
}) %}
{% set icon = null %}
{% endif %}
<a href="{{ url }}">
{% if icon is defined %}
<span class="{{ icon }}"></span>
{% endif %}
{{ label|trans }} {{ label|trans }}
</a> {% endif %}
{% else %} {% else %}
{{ label|trans }} {{ label|trans }}
{% endif %} {% endif %}
{% else %} </th>
{{ label|trans }} {% endblock %}
{% endif %}
</th>
{% endfor %} {% endfor %}
<th class="col-2 miw-100 text-right"> <th class="col-2 miw-100 text-right">
{{ 'Actions'|trans }} {{ 'Actions'|trans }}
@ -222,7 +224,7 @@
<tr> <tr>
<td class="col-12 text-black-50 border-0" colspan="{{ configuration.fields(context)|length + 1 }}"> <td class="col-12 text-black-50 border-0" colspan="{{ configuration.fields(context)|length + 1 }}">
<span class="fa fa-hand-pointer"></span> <span class="fa fa-hand-pointer"></span>
{{ 'You can sort items by drag & drop'|trans }} {{ 'You can sort items with drag & drop'|trans }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}