Amélioration de la navigation par tags:

- Fix #375: liens cliquables sur les modaux
- quand on est sur une page tag, les liens "quand" renvoient à l'agenda filtré par le tag de la pag
This commit is contained in:
Jean-Marie Favreau 2025-03-18 22:56:27 +01:00
parent d3bcfc0cbf
commit 85d7c64875
3 changed files with 29 additions and 1 deletions

View File

@ -191,7 +191,11 @@
</header> </header>
<div class="body-fixed">{{ event.description |linebreaks }}</div> <div class="body-fixed">{{ event.description |linebreaks }}</div>
<p> <p>
{% for tag in event.sorted_tags %}{{ tag | tag_button }}{% endfor %} {% for tag in event.sorted_tags %}
<a href="{% url 'view_tag' tag|prepare_tag %}"
role="button"
class="small-cat">{{ tag|tw_highlight }}</a>
{% endfor %}
</p> </p>
<footer class="infos-and-buttons"> <footer class="infos-and-buttons">
<div class="buttons"> <div class="buttons">

View File

@ -9,6 +9,10 @@
{% block entete_header %} {% block entete_header %}
{% css_categories %} {% css_categories %}
{% endblock %} {% endblock %}
{% block when_parameters %}tags={{ tag|prepare_tag }}{% endblock %}
{% block navigation-menu %}
{% navigation_links_tag tag %}
{% endblock %}
{% block body-class %}tag{% endblock %} {% block body-class %}tag{% endblock %}
{% block content %} {% block content %}
<article> <article>

View File

@ -188,6 +188,26 @@ def no_emoji(text):
return emoji.replace_emoji(text, replace="") return emoji.replace_emoji(text, replace="")
@register.simple_tag
def navigation_links_tag(tag):
from .tag_extra import prepare_tag
result = ""
extra = "?tags=" + prepare_tag(tag)
for t in [
("aujourdhui", "aujourd'hui"),
("a_venir", "ces jours-ci"),
("cette_semaine", "cette semaine"),
("ce_mois_ci", "ce mois-ci"),
]:
result += (
'<li><a href="' + reverse_lazy(t[0]) + extra + '">' + t[1] + "</a></li>"
)
return mark_safe(result)
@register.simple_tag @register.simple_tag
def navigation_links(filter, category, calendar, current_view): def navigation_links(filter, category, calendar, current_view):
extra = "?" + filter.get_url() extra = "?" + filter.get_url()