Amélioration de la vue des étiquettes
This commit is contained in:
parent
4a0f5b3b14
commit
1e9698da91
@ -886,6 +886,10 @@ form .buttons [role="button"] {
|
|||||||
margin: 2em auto;
|
margin: 2em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.min-y-grid {
|
||||||
|
min-height: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 992px) {
|
@media (min-width: 992px) {
|
||||||
.grid.two-columns {
|
.grid.two-columns {
|
||||||
grid-column-gap: var(--nav-element-spacing-vertical);
|
grid-column-gap: var(--nav-element-spacing-vertical);
|
||||||
|
@ -22,35 +22,42 @@
|
|||||||
<header>
|
<header>
|
||||||
<h1>Les étiquettes des événements</h1>
|
<h1>Les étiquettes des événements</h1>
|
||||||
</header>
|
</header>
|
||||||
{% if tags %}
|
|
||||||
|
|
||||||
|
{% if tags %}
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<article class="tag-description no-image">
|
<div class="grid two-columns grid-reverse min-y-grid">
|
||||||
<header><a href="{% url 'view_tag' tag.name|prepare_tag %}" role="button" class="small-cat">{{ tag.name }}</a></header>
|
|
||||||
<div>
|
<div>
|
||||||
{{ tag.description|safe }}
|
<a href="{% url 'view_tag' tag.tag|prepare_tag %}" role="button" class="small-cat">{{ tag.tag }}: {{ tag.count }}</a>
|
||||||
<p>{% if tag.category %}Cette étiquette est une sous-catégorie de {{ tag.category| small_cat:tag.category.get_absolute_url }}{% endif %}</p>
|
</div>
|
||||||
|
<div>
|
||||||
|
{% if tag.obj %}
|
||||||
|
{% if not tag.obj.description|html_vide %}{{ tag.obj.description|safe }}{% endif %}
|
||||||
|
{% if tag.obj.category or tag.obj.principal or tag.obj.in_included_suggestions or tag.obj.in_excluded_suggestions %}
|
||||||
|
<ul class="remarque">
|
||||||
|
{% if tag.obj.category %}
|
||||||
|
<li>Cette étiquette est une sous-catégorie de {{ tag.obj.category| small_cat:tag.obj.category.get_absolute_url }}</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if tag.obj.principal %}
|
||||||
|
<li>Cette étiquette est mise en avant parmi les étiquettes principales.</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if tag.obj.in_included_suggestions %}
|
||||||
|
<li>Cette étiquette fait partie des étiquettes suggérées à inclure.</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if tag.obj.in_excluded_suggestions %}
|
||||||
|
<li>Cette étiquette fait partie des étiquettes suggérées à exclure.</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<p>-</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><em>Il n'y a aucune étiquette disposant d'une description.</em></p>
|
<p><em>Il n'y a aucune étiquette.</em></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<footer>
|
|
||||||
{% if other_tags %}
|
|
||||||
<p>Liste des étiquettes sans description :</p>
|
|
||||||
<div>
|
|
||||||
{% for tag in other_tags %}
|
|
||||||
{% if tag|tag_not_in_db:tags %}
|
|
||||||
<a href="{% url 'view_tag' tag|prepare_tag %}" role="button" class="small-cat">{{ tag }}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<p><em>Il n'y a aucune étiquette sans description.</em></p>
|
|
||||||
{% endif %}
|
|
||||||
</footer>
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{% endcache %}
|
{% endcache %}
|
||||||
|
@ -8,6 +8,7 @@ from dateutil.relativedelta import relativedelta
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
from string import ascii_uppercase as auc
|
from string import ascii_uppercase as auc
|
||||||
|
from django.utils.html import strip_tags
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@ -126,4 +127,13 @@ def tocoords(c):
|
|||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def index(indexable, i):
|
def index(indexable, i):
|
||||||
return indexable[i]
|
return indexable[i]
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def is_string(val):
|
||||||
|
return isinstance(val, str)
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def html_vide(val):
|
||||||
|
return len(strip_tags(val).replace(" ", "").strip()) == 0
|
||||||
|
|
||||||
|
@ -1872,8 +1872,13 @@ def view_tag(request, t):
|
|||||||
|
|
||||||
|
|
||||||
def tag_list(request):
|
def tag_list(request):
|
||||||
tags = [t["tag"] for t in Event.get_all_tags()]
|
tags = Event.get_all_tags()
|
||||||
objects = Tag.objects.order_by("name").all()
|
objects = Tag.objects.order_by("name").all()
|
||||||
context = {"other_tags": sorted(tags, key=lambda x: remove_accents(x).lower()),
|
d_objects = dict()
|
||||||
"tags": objects}
|
for o in objects:
|
||||||
|
d_objects[o.name] = o
|
||||||
|
|
||||||
|
tags = [t | {'obj': d_objects[t["tag"]]} if t["tag"] in d_objects else t for t in tags]
|
||||||
|
|
||||||
|
context = {"tags": sorted(tags, key=lambda x: remove_accents(x["tag"]).lower())}
|
||||||
return render(request, "agenda_culturel/tags.html", context)
|
return render(request, "agenda_culturel/tags.html", context)
|
Loading…
x
Reference in New Issue
Block a user