Sort and filter mutually respect each other

This commit is contained in:
Mouse Reeve 2021-04-01 17:38:53 -07:00
parent 634509a7f3
commit 62bd744b69
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">