Merge pull request #847 from mouse-reeve/sort-filter-interactions

Sort and filter mutually respect each other
This commit is contained in:
Mouse Reeve 2021-04-01 18:01:43 -07:00 committed by GitHub
commit 16066e8340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -11,7 +11,10 @@
</span>
</h2>
<form class="hidden mt-3" id="filters" method-"get" action="{{ request.path }}" tabindex="0">
<form class="hidden mt-3" id="filters" method="get" action="{{ request.path }}" tabindex="0">
{% if sort %}
<input type="hidden" name="sort" value="{{ sort }}">
{% endif %}
<div class="columns">
{% block filter_fields %}
{% endblock %}

View file

@ -1,5 +1,5 @@
{% load i18n %}
<a href="{{ url }}?sort={% if sort == field %}-{% endif %}{{ field }}">
<a href="{{ url }}?sort={% if sort == field %}-{% endif %}{{ field }}{% for k, v in request.GET.items %}{% if k != "sort" %}&{{ k }}={{ v }}{% endif %}{% endfor %}">
{{ text }}
{% if sort == field %}
<span class="icon icon-arrow-up">