Make list filters toggleable.

This commit is contained in:
Christopher Charbonneau Wells 2018-03-13 20:16:16 -07:00
parent 742c21d003
commit 81e4a1ea51
1 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{% load widget_tweaks %} {% load widget_tweaks %}
<form role="form" action="" method="get"> <form id="filter_form" role="form" action="" method="get" class="collapse{% if request.GET.filtered %} show{% endif %}">
<div class="form-group form-row"> <div class="form-group form-row">
{% for field in filter.form %} {% for field in filter.form %}
<label for="id_{{ field.name }}" class="col-xs-2 col-sm-auto col-form-label col-form-label-sm"> <label for="id_{{ field.name }}" class="col-xs-2 col-sm-auto col-form-label col-form-label-sm">
@ -16,7 +16,19 @@
{% endfor %} {% endfor %}
<div class="col-xs-12 col-sm-auto mt-3 mt-sm-0"> <div class="col-xs-12 col-sm-auto mt-3 mt-sm-0">
<button type="submit" class="btn btn-sm btn-primary mr-2">Filter</button> <button type="submit" class="btn btn-sm btn-primary mr-2">Filter</button>
<a href="{{ request.path }}" class="btn btn-sm btn-dark">Reset</a> <a href="{{ request.path }}" class="btn btn-sm btn-error">Reset</a>
</div> </div>
</div> </div>
<input type="hidden" name="filtered" value="1"/>
</form> </form>
<p>
<a class="btn btn-dark btn-sm"
data-toggle="collapse"
href="#filter_form"
role="button"
aria-expanded="false"
aria-controls="filter_form">
Filters
</a>
</p>