Icon added to the column which is sorted by user.
This commit is contained in:
parent
665a1c1f85
commit
94b5d27ba5
|
@ -17,14 +17,20 @@
|
||||||
{% set orderBy = app.request.query.get('order-by') %}
|
{% set orderBy = app.request.query.get('order-by') %}
|
||||||
{% set order = app.request.query.get('order') %}
|
{% set order = app.request.query.get('order') %}
|
||||||
{% for column, property in columns %}
|
{% for column, property in columns %}
|
||||||
|
{% set isCurrent = (property == orderBy) %}
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
{% if property is not null %}
|
{% if property is not null %}
|
||||||
<a href="{{ path(route, {
|
<a href="{{ path(route, {
|
||||||
'query': query,
|
'query': query,
|
||||||
'page': page,
|
'page': page,
|
||||||
'order-by': property,
|
'order-by': property,
|
||||||
'order': (order and property == orderBy) ? ('asc' == order|lower ? 'desc' : 'asc') : 'asc'
|
'order': (order and isCurrent) ? ('asc' == order|lower ? 'desc' : 'asc') : 'asc'
|
||||||
}) }}">{{ column | raw }}</a>
|
}) }}">
|
||||||
|
{% if order and isCurrent %}
|
||||||
|
<i class="fas fa-sort-{% if 'asc' == order|lower %}down{% elseif 'desc' == order|lower %}up{% endif %}"></i>
|
||||||
|
{% endif %}
|
||||||
|
{% if isCurrent %}<b>{% endif %}{{ column | raw }}{% if isCurrent %}</b>{% endif %}
|
||||||
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ column | raw }}
|
{{ column | raw }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{{ pagerfanta(torrents) }}
|
{{ pagerfanta(torrents) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table table-hover" id="table-torrents">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
{{ sortable.sortable_columns({
|
{{ sortable.sortable_columns({
|
||||||
|
|
Loading…
Reference in a new issue