Merged in sortable_table_icons (pull request #12)

Icon added to the column which is sorted by user.
This commit is contained in:
Alexey Eschenko 2018-07-01 01:05:10 +00:00
commit 45dd6d46ee
3 changed files with 10 additions and 4 deletions

View file

@ -17,14 +17,20 @@
{% set orderBy = app.request.query.get('order-by') %}
{% set order = app.request.query.get('order') %}
{% for column, property in columns %}
{% set isCurrent = (property == orderBy) %}
<th scope="col">
{% if property is not null %}
<a href="{{ path(route, {
'query': query,
'page': page,
'order-by': property,
'order': (order and property == orderBy) ? ('asc' == order|lower ? 'desc' : 'asc') : 'asc'
}) }}">{{ column | raw }}</a>
'order': (order and isCurrent) ? ('asc' == order|lower ? 'desc' : 'asc') : 'asc'
}) }}">
{% 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 %}
{{ column | raw }}
{% endif %}

View file

@ -5,7 +5,7 @@
{{ pagerfanta(torrents) }}
</div>
<table class="table">
<table class="table table-hover" id="table-torrents-list">
<thead class="thead-light">
<tr>
{{ sortable.sortable_columns({