Merge pull request #1726 from joachimesque/options-panels

Front-end: New look and behavior for Filters and Result panels
This commit is contained in:
Mouse Reeve
2022-01-03 09:23:12 -08:00
committed by GitHub
9 changed files with 255 additions and 109 deletions

View File

@ -1,6 +1,4 @@
<div class="column is-flex">
<div class="box is-flex-grow-1">
{% block filter %}
{% endblock %}
</div>
<div class="filters-field column">
{% block filter %}
{% endblock %}
</div>

View File

@ -1,28 +1,47 @@
{% load i18n %}
<div class="notification content">
<h2 class="columns is-mobile mb-0">
<span class="column pb-0">Filters</span>
<details class="details-panel box is-size-{{ size|default:'normal' }}" {% if filters_applied %}open{% endif %}>
<summary class="is-flex is-align-items-center is-flex-wrap-wrap is-gap-2">
<span class="mb-0 title {% if size == 'small' %}is-6{% else %}is-5{% endif %} is-flex-shrink-0">
{% trans "Filters" %}
<span class="column is-narrow pb-0">
{% trans "Show filters" as text %}
{% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon_with_text="arrow-down" class="is-small" focus="filters" %}
{% trans "Hide filters" as text %}
{% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon_with_text="arrow-up" class="is-small" %}
</span>
</h2>
<form class="is-hidden mt-3" id="filters" method="get" action="{{ request.path }}" tabindex="0">
{% if sort %}
<input type="hidden" name="sort" value="{{ sort }}">
{% if filters_applied %}
<span class="tag is-success is-light ml-2 mb-0 is-{{ size|default:'normal' }}">
{{ _("Filters are applied") }}
</span>
{% endif %}
<div class="columns">
{% block filter_fields %}
{% endblock %}
</div>
<button class="button is-primary">{% trans "Apply filters" %}</button>
</form>
{% if request.GET %}
<a class="help" href="{{ request.path }}">{% trans "Clear filters" %}</a>
{% endif %}
</div>
{% if request.GET %}
<span class="mb-0 tags has-addons">
<span class="mb-0 tag is-success is-light is-{{ size|default:'normal' }}">
{% trans "Filters are applied" %}
</span>
<a class="mb-0 tag is-success is-{{ size|default:'normal' }}" href="{{ request.path }}">
{% trans "Clear filters" %}
</a>
</span>
{% endif %}
<span class="details-close icon icon-x is-{{ size|default:'normal' }}" aria-hidden></span>
</summary>
<div class="mt-3">
<form id="filters" method="{{ method|default:'get' }}" action="{{ action|default:request.path }}">
{% if method == 'post' %}
{% csrf_token %}
{% endif %}
{% if sort %}
<input type="hidden" name="sort" value="{{ sort }}">
{% endif %}
<div class="mt-3 columns filters-fields is-align-items-stretch">
{% block filter_fields %}
{% endblock %}
</div>
<button type="submit" class="button is-primary is-small">
{% trans "Apply filters" %}
</button>
</form>
</div>
</details>