Merged in sortable_table_icons (pull request #12)
Icon added to the column which is sorted by user.
This commit is contained in:
commit
45dd6d46ee
|
@ -1,3 +1,3 @@
|
||||||
#content {
|
#content {
|
||||||
margin-top: 80px;
|
margin-top: 80px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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-list">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
{{ sortable.sortable_columns({
|
{{ sortable.sortable_columns({
|
||||||
|
|
Loading…
Reference in a new issue