Column headers now link to sort/desc sort - refs #189

This commit is contained in:
Simon Willison 2018-04-08 19:08:28 -07:00 committed by Simon Willison
commit 747a801b50
3 changed files with 50 additions and 14 deletions

View file

@ -1,7 +1,19 @@
<table>
<thead>
<tr>
{% for column in display_columns %}<th scope="col">{{ column }}</th>{% endfor %}
{% for i, column in enumerate(display_columns) %}
<th scope="col">
{% if i == 0 or disable_sort %}
{{ column }}
{% else %}
{% if column == sort %}
<a href="{{ path_with_added_args(request, {'_sort_desc': column, '_sort': None, '_next': None}) }}" rel="nofollow">{{ column }}&nbsp;</a>
{% else %}
<a href="{{ path_with_added_args(request, {'_sort': column, '_sort_desc': None, '_next': None}) }}" rel="nofollow">{{ column }}{% if column == sort_desc %}&nbsp;▲{% endif %}</a>
{% endif %}
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
<tbody>