Amélioration rendu catégories

This commit is contained in:
Jean-Marie Favreau 2024-11-02 20:02:39 +01:00
parent 57344ff5b9
commit d685f7e63a
2 changed files with 35 additions and 13 deletions

View File

@ -124,11 +124,28 @@ details[role="list"] summary + ul li.selected>a:hover {
#filters {
.categories {
text-align: center;
line-height: 2.8em;
[data-tooltip]::before, [data-tooltip]::after {
display: none;
}
.developpe, .non-developpe {
background: var(--primary-focus);
color: var(--contrast);
border-radius: 1.3em;
height: 2.4em;
padding: 0.1em .2em;
.titre {
vertical-align: middle;
margin-right: .4em;
}
display: inline-block;
margin: .1em 0;
}
.non-developpe {
background: none;
padding: 0.1em 0;
}
}
.suggested-tags {
font-size: 80%;
@ -188,12 +205,11 @@ details[role="list"] summary + ul li.selected>a:hover {
height: 2.6em;
width: 2.6em;
border-radius: 1.3em;
line-height: 2.4em;
line-height: 2.2em;
img {
width: 80%;
margin: .2em 0;
width: 70%;
margin: .4em 0;
}
overflow: hidden;
}
.reduced {

View File

@ -214,7 +214,7 @@ def circle_cat(category, recurrence=False):
'<span class="cat ' + c + ' circ-cat" data-tooltip="' + n + '"></span>'
)
def legend_cat(category, url, selected=True, first=False):
def legend_cat(category, url, selected=True, first=False, with_title=False):
c = category.css_class()
n = category.name
class_reduced = '' if selected else 'reduced'
@ -227,13 +227,18 @@ def legend_cat(category, url, selected=True, first=False):
prefix = "ajouter "
if category.pictogram:
return mark_safe(
'<a href="' + url + '"><span class="cat ' + class_reduced + ' ' + c + ' circ-cat circ-large" data-tooltip="' + prefix + n + '">' + '<img src="' + category.pictogram.url + '" alt="' + category.name + '" /></span></a>'
)
result = '<span class="cat ' + class_reduced + ' ' + c + ' circ-cat circ-large" data-tooltip="' + prefix + n + '">' + '<img src="' + category.pictogram.url + '" alt="' + category.name + '" /></span>'
else:
return mark_safe(
'<a href="' + url + '"><span class="cat ' + class_reduced + ' ' + c + ' circ-cat circ-large" data-tooltip="' + prefix + n + '"></span></a>'
)
result = '<span class="cat ' + class_reduced + ' ' + c + ' circ-cat circ-large" data-tooltip="' + prefix + n + '"></span>'
if with_title and selected:
result = '<div class="developpe">' + result + ' <span class="titre">' + n + '</span></div>'
else:
result = '<div class="non-developpe">' + result + '</div>'
result = '<a href="' + url + '">' + result + '</a>'
return mark_safe(result)
@register.simple_tag
@ -250,6 +255,7 @@ def show_legend(filter):
if not filter.is_selected(c)
else filter.get_url_remove_categories([c.pk]),
selected=filter.is_selected(c),
with_title=True
)
for c in cats
]