work on lists filters + nav items

This commit is contained in:
bkfox
2020-11-08 17:54:49 +01:00
parent 774c558a36
commit 7860d9f92b
13 changed files with 126 additions and 86 deletions

View File

@ -5,7 +5,6 @@ variables.
Usefull context:
- cover: image cover
- site: current website
- has_filters: display filter bar (using block "filters")
- model: view model or displayed `object`'s
- sidebar_object_list: item to display in sidebar
- sidebar_url_name: url name sidebar item complete list
@ -99,17 +98,6 @@ Usefull context:
<section class="content">{{ page.content|safe }}</section>
{% endif %}
{% endblock %}
{# TODO: change block name #}
{% if has_filters %}
{% comment %}Translators: extra toolbar displayed on the top of page lists {% endcomment %}
<nav class="navbar toolbar"
aria-label="{% trans "list filters" %}">
{% block filters %}{% endblock %}
</nav>
{% endif %}
{% endblock main %}
</main>

View File

@ -24,6 +24,49 @@
{% block main %}{{ block.super }}
{% block before_list %}
{% if filters %}
<form method="GET" action="" class="media">
<div class="media-content">
{% block filters %}
{% for label, name, choices in filters %}
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{{ label }}</label>
</div>
<div class="field-body">
<div class="field is-narrow">
<div class="control">
{% for label, value, checked in choices %}
<label class="checkbox">
<input type="checkbox" class="checkbox" name="{{ name }}"
value="{{ value }}"
{% if checked %}checked{% endif %} />
{{ label }}
</label>
{% endfor %}
</div>
</div>
</div>
</div>
{% endfor %}
{% endblock %}
</div>
<div class="media-right">
<div class="field is-grouped is-grouped-right">
<div class="control">
<button class="button is-primary"/>{% trans "Apply" %}</button>
</div>
<div class="control">
<a href="?" class="button is-secondary">{% trans "Reset" %}</a>
</div>
</div>
</div>
</form>
{% endif %}
{% endblock %}
<section role="list">
{% block pages_list %}
{% with has_headline=True %}

View File

@ -14,7 +14,7 @@
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
{% block filters %}
{% block before_list %}
{% with "diffusion-list" as url_name %}
{% include "aircox/widgets/dates_menu.html" %}
{% endwith %}

View File

@ -15,7 +15,7 @@
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
{% block filters %}
{% block before_list %}
{% with "log-list" as url_name %}
{% include "aircox/widgets/dates_menu.html" %}
{% endwith %}

View File

@ -2,49 +2,3 @@
{% comment %}Display a list of Pages{% endcomment %}
{% load i18n aircox %}
{% block filters %}
{# FIXME #}
{% if filter_categories %}
<form method="GET" action="" class="navbar-menu">
<div class="navbar-start">
<div class="navbar-item">
{% block list_filters %}
<div class="field is-horizontal">
<div class="field-label">
<label class="label">{% trans "Categories" %}</label>
</div>
<div class="field-body">
<div class="field is-narrow">
<div class="control">
{% for category in filter_categories %}
<label class="checkbox">
<input type="checkbox" class="checkbox" name="categories"
value="{{ category.slug }}"
{% if category.slug in categories %}checked{% endif %} />
{{ category.title }}
</label>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}
</div>
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="field is-grouped is-grouped-right">
<div class="control">
<button class="button is-primary"/>{% trans "Apply" %}</button>
</div>
<div class="control">
<a href="?" class="button is-secondary">{% trans "Reset" %}</a>
</div>
</div>
</div>
</div>
</form>
{% endif %}
{% endblock %}