From 9fdd3edd0eda42ceccd0c20549560ea99e5177b9 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sat, 14 Sep 2024 14:56:00 +0200 Subject: [PATCH] =?UTF-8?q?Simplification=20de=20l'affichage=20du=20choix?= =?UTF-8?q?=20des=20cat=C3=A9gories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/static/style.scss | 22 +++++++++++++++++-- src/agenda_culturel/templatetags/cat_extra.py | 18 ++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/agenda_culturel/static/style.scss b/src/agenda_culturel/static/style.scss index 73ad1f7..2855357 100644 --- a/src/agenda_culturel/static/style.scss +++ b/src/agenda_culturel/static/style.scss @@ -165,6 +165,20 @@ details[role="list"] summary + ul li.selected>a:hover { padding: 0.15em 0.4em 0.3em 0.4em; } + +.circ-cat.circ-large { + height: 3em; + width: 3em; + border-radius: 1.5em; + +} +.reduced { + opacity: .3; +} +.reduced:hover { + opacity: 1; +} + ul { margin-left: 1em; } @@ -176,10 +190,14 @@ span.small-cat { .simple-button { @extend .small-cat; border-radius: 1em; - font-size: 80%; margin-left: .5em; padding: .1em .5em; } +.button-bar { + display: flex; + align-items: center; + column-gap: .3em; +} svg { vertical-align: -0.125em; @@ -405,7 +423,7 @@ header .title { } body > main { - padding-top: 0; + padding-top: 0.2em; } article { diff --git a/src/agenda_culturel/templatetags/cat_extra.py b/src/agenda_culturel/templatetags/cat_extra.py index 010d867..05aa999 100644 --- a/src/agenda_culturel/templatetags/cat_extra.py +++ b/src/agenda_culturel/templatetags/cat_extra.py @@ -214,6 +214,14 @@ def circle_cat(category, recurrence=False): '' ) +def large_circle_cat(category, url, selected=True): + c = category.css_class() + n = category.name + class_reduced = '' if selected else 'reduced' + + return mark_safe( + '' + ) @register.simple_tag @@ -221,23 +229,23 @@ def show_legend(filter): filter.form.full_clean() cats = Category.objects.all() if filter.is_active(only_categories=True): - return mark_safe("
" + + return mark_safe('
' + " ".join( [ - small_cat( + large_circle_cat( c, filter.get_url_add_categories([c.pk]) if not filter.is_selected(c) else filter.get_url_remove_categories([c.pk]), - contrast=filter.is_selected(c), + selected=filter.is_selected(c), ) for c in cats ] - ) + ' ' + picto_from_name('x-circle') + ' toutes
' + ) + ' ' + picto_from_name('x-circle') + ' toutes
' ) else: return mark_safe("
" + " ".join( - [small_cat(c, filter.get_url_add_categories([c.pk])) for c in cats] + [large_circle_cat(c, filter.get_url_add_categories([c.pk])) for c in cats] ) + "
" )