On rend le site fonctionnel même sans javascript

Fix #88
This commit is contained in:
Jean-Marie Favreau 2024-05-03 14:48:17 +02:00
parent 32785b0459
commit b2a4df5be7
2 changed files with 12 additions and 3 deletions

View File

@ -27,7 +27,7 @@
<ul> <ul>
{% for category, events in day.events_by_category.items %} {% for category, events in day.events_by_category.items %}
<li>{{ events.0.category | circle_cat }} <li>{{ events.0.category | circle_cat }}
<a href="{{ daytag }}" data-target="{{ daytag }}-category-{{ events.0.category.pk }}" onClick="toggleModal(event)">{{ events | length }} {{ category }}</a></li> <a href="{{ day.date | url_day }}?{{ filter.get_url|add_url_category:events.0.category }}" data-target="{{ daytag }}-category-{{ events.0.category.pk }}" onClick="toggleModal(event)">{{ events | length }} {{ category }}</a></li>
<dialog id="{{ daytag }}-category-{{ events.0.category.pk }}"> <dialog id="{{ daytag }}-category-{{ events.0.category.pk }}">
<article> <article>
<header> <header>
@ -66,7 +66,7 @@
{% if event.start_day == day.date and event.start_time %} {% if event.start_day == day.date and event.start_time %}
{{ event.start_time }} {{ event.start_time }}
{% endif %} {% endif %}
{{ event|picto_status }} <a href="{{ daytag }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title }}</a> {{ event|picto_status }} <a href="{{ event.get_absolute_url }}" data-target="event-{{ event.id }}" onClick="toggleModal(event)">{{ event.title }}</a>
<dialog id="event-{{ event.id }}"> <dialog id="event-{{ event.id }}">
{% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %} {% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %}
</dialog> </dialog>

View File

@ -4,7 +4,7 @@ from django.urls import reverse_lazy
from django.template.defaultfilters import pluralize, linebreaks, urlize from django.template.defaultfilters import pluralize, linebreaks, urlize
from agenda_culturel.models import Event from agenda_culturel.models import Event, Category
from django.db.models import Q from django.db.models import Q
from .utils_extra import picto_from_name from .utils_extra import picto_from_name
@ -125,3 +125,12 @@ def field_to_html(field, key):
return "-" return "-"
else: else:
return field return field
@register.filter
def add_url_category(url, c):
if c is None:
return url
if url == "":
return "category=" + str(c.pk)
else:
return url + "&category=" + str(c.pk)