64 lines
1.7 KiB
Twig
64 lines
1.7 KiB
Twig
<thead>
|
|
{% if pager|length %}
|
|
<tr>
|
|
{% if batch_actions %}
|
|
<th class="batch_th">
|
|
<input type="checkbox" />
|
|
</th>
|
|
|
|
{% set counter = counter + 1 %}
|
|
{% endif %}
|
|
|
|
{% for field in fields %}
|
|
{% set attrs = {'class': 'cols_th'} %}
|
|
|
|
{% if fields_attrs[field.name] is defined %}
|
|
{% set attrs = fields_attrs[field.name] %}
|
|
{% if attrs.class is defined %}
|
|
{% set attrs = attrs|merge({'class': attrs['class'] ~ ' cols_th'}) %}
|
|
{% else %}
|
|
{% set attrs = attrs|merge({'class': 'cols_th'}) %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
<th {% for attr, attr_value in attrs %}{{ attr }}="{{ attr_value }}" {% endfor %}>
|
|
{% if fieldsnames %}
|
|
{% set label = fieldsnames[field.name] is defined ? fieldsnames[field.name]|trans() : field.name|trans() %}
|
|
{% else %}
|
|
{% set label = field.name|capitalize|trans() %}
|
|
{% endif %}
|
|
|
|
{% set new_sort = (pager_sort == field.name ~ ":asc") ? field.name ~ ":desc" : field.name ~ ":asc" %}
|
|
|
|
<a href="{{ path(route_prefix ~ "index", { page: pager.currentPage, sort: new_sort }) }}">
|
|
{{ label }}
|
|
|
|
{% if pager_sort == field.name ~ ":asc" %}
|
|
{% set icon = "icon-arrow-up" %}
|
|
{% elseif pager_sort == field.name ~ ":desc" %}
|
|
{% set icon = "icon-arrow-down" %}
|
|
{% else %}
|
|
{% set icon = "" %}
|
|
{% endif %}
|
|
|
|
{% if icon %}
|
|
<i class="{{ icon }}"></i>
|
|
{% endif %}
|
|
</a>
|
|
</th>
|
|
|
|
{% set counter = counter + 1 %}
|
|
{% endfor %}
|
|
|
|
{% if list_actions|length %}
|
|
<th class="actions_th"></th>
|
|
{% set counter = counter + 1 %}
|
|
{% endif %}
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td></td>
|
|
</tr>
|
|
{% endif %}
|
|
</thead>
|