On ajoute une légende en pied de page

Fix #51
This commit is contained in:
Jean-Marie Favreau 2023-12-17 15:21:10 +01:00
parent d9e06aa776
commit b9ecde46e5
8 changed files with 31 additions and 23 deletions

View File

@ -171,7 +171,7 @@ footer {
overflow: auto;
.grid {
grid-template-columns: repeat(auto-fit, minmax(0%, 1fr));
min-width: 1200px;
min-width: 1500px;
}
.grid.week-in-month {
grid-template-columns: 2.5em repeat(auto-fit, minmax(0%, 1fr));
@ -212,6 +212,7 @@ footer {
article.day {
margin: 0;
padding: 0 0 0.3em 0;
min-height: 12em;
}
article.day>header {

View File

@ -5,7 +5,7 @@
<details>
<summary role="button" class="contrast outline">
{% if filter.is_active %}
Filtres&nbsp;:
Filtre&nbsp;:
{% for c in filter.get_categories %}
{{ c | small_cat }}
{% endfor %}

View File

@ -1,14 +0,0 @@
{% extends "agenda_culturel/page_event.html" %}
{% block title %}Accueil{% endblock %}
{% block events %}
<h1>Événements</h1>
<ul>
{% for event in object_list %}
<li><a href="{{ BASE_URL }}{{ event.get_absolute_url }}">{{ event.start_day|date }} : {{ event.title }}</a></li>
{% empty %}
<li>Il n'y a pas d'événement.</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -52,6 +52,10 @@
{% endfor %}
</div>
</div>
<div>
Légende&nbsp;: {% show_legend filter=filter %}
</div>
<footer>
{% if calendar.today_in_calendar %}

View File

@ -51,9 +51,13 @@
{% endfor %}
</div>
</div>
<div>
Légende&nbsp;: {% show_legend filter=filter %}
</div>
<footer>
{% if calendar.today_in_calendar %}
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
{% endif %}

View File

@ -89,7 +89,7 @@ def css_categories():
return mark_safe(result)
@register.filter
def small_cat(category, url=None, contrast=True, close_url=None):
def small_cat(category, url=None, contrast=True):
name = Category.default_name if category is None else category.name
css_class = Category.default_css_class if category is None else category.css_class()
@ -107,6 +107,12 @@ def circle_cat(category):
else:
return mark_safe('<span class="cat ' + category.css_class() + ' circ-cat" data-tooltip="' + category.name + '"></span>')
@register.filter
def small_cat_close(category, close_url=None, contrast=True):
return small_cat(category, close_url=close_url, contrast=contrast)
@register.simple_tag
def show_legend(filter):
current_url = filter.get_url_without_filters()
cats = Category.objects.all()
if filter.is_active(only_categories=True):
return mark_safe(" ".join([small_cat(c, current_url + "?category=" + str(c.pk) if not filter.is_selected(c) else None, contrast=filter.is_selected(c)) for c in cats]))
else:
return mark_safe(" ".join([small_cat(c, current_url + "?category=" + str(c.pk)) for c in cats]))

View File

@ -42,4 +42,5 @@ def show_badges_events():
if nb_drafts != 0:
return mark_safe('<a href="' + reverse_lazy("moderation") + '?status=draft" class="badge" data-tooltip="' + str(nb_drafts) + ' brouillon' + pluralize(nb_drafts) + ' à valider">' + picto_from_name("calendar") + " " + str(nb_drafts) + '</a>')
else:
return ""
return ""

View File

@ -88,8 +88,14 @@ class EventFilter(django_filters.FilterSet):
def get_tags(self):
return self.form.cleaned_data["tags"]
def is_active(self):
return len(self.form.cleaned_data["category"]) != 0 or len(self.form.cleaned_data["tags"]) != 0
def is_active(self, only_categories=False):
if only_categories:
return len(self.form.cleaned_data["category"]) != 0
else:
return len(self.form.cleaned_data["category"]) != 0 or len(self.form.cleaned_data["tags"]) != 0
def is_selected(self, cat):
return cat in self.form.cleaned_data["category"]
def mentions_legales(request):