From f50c9b47ac146b0cfaa0499a9a3fc902f514467e Mon Sep 17 00:00:00 2001
From: Jean-Marie Favreau
Date: Sat, 11 Nov 2023 13:52:43 +0100
Subject: [PATCH] =?UTF-8?q?On=20s=C3=A9pare=20en=20plusieurs=20fichiers=20?=
=?UTF-8?q?les=20=C3=A9v=C3=A9nements,=20c'est=20plus=20lisible?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../templates/agenda_culturel/day-inc.html | 2 +-
.../templates/agenda_culturel/event-inc.html | 155 ------------------
.../templates/agenda_culturel/page-day.html | 13 +-
.../templates/agenda_culturel/page-event.html | 2 +-
.../templates/agenda_culturel/page-month.html | 11 +-
.../templates/agenda_culturel/page-week.html | 11 +-
.../event-in-list-by-day-inc.html | 77 +++++++++
.../single-event/event-in-list-inc.html | 71 ++++++++
.../single-event/event-modal-inc.html | 44 +++++
.../single-event/event-single-inc.html | 56 +++++++
.../templates/agenda_culturel/tag.html | 2 +-
.../templatetags/event_extra.py | 4 +-
12 files changed, 269 insertions(+), 179 deletions(-)
delete mode 100644 src/agenda_culturel/templates/agenda_culturel/event-inc.html
create mode 100644 src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-by-day-inc.html
create mode 100644 src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
create mode 100644 src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
create mode 100644 src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
diff --git a/src/agenda_culturel/templates/agenda_culturel/day-inc.html b/src/agenda_culturel/templates/agenda_culturel/day-inc.html
index 3e451fc..8f560f2 100644
--- a/src/agenda_culturel/templates/agenda_culturel/day-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/day-inc.html
@@ -57,7 +57,7 @@
{% endif %}
{{ event|picto_status }} {{ event.title }}
- {% include "agenda_culturel/event-inc.html" with event=event display="modal" close_button=1 filter=filter %}
+ {% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %}
{% endfor %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/event-inc.html b/src/agenda_culturel/templates/agenda_culturel/event-inc.html
deleted file mode 100644
index 9424395..0000000
--- a/src/agenda_culturel/templates/agenda_culturel/event-inc.html
+++ /dev/null
@@ -1,155 +0,0 @@
-{% load static %}
-{% load cat_extra %}
-{% load utils_extra %}
-{% load event_extra %}
-{% load tag_extra %}
-
-
- {% if display in "in list by day" %}
- {% if display == "in list by day" and event|can_show_start_time %}
-
- {% if event.start_time %}
- {% if display == "in list" %}{% endif %}
- {{ event.start_time }}
- {% if display == "in list" %} {% endif %}
- {% endif %}
-
- {% endif %}
- {% if display == "in list" %}
- {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
- {% endif %}
- {{ event.category | small_cat }}
- {% if event.location %}{% endif %}
- {% if display == "in list" %}{% else %}{% endif %}
- {{ event|picto_status }}
- {{ event.title }}
- {% if display == "in list" %} {% else %}{% endif %}
- {% if event.location %}
- {% if display == "in list" %}{% else %}{% endif %}
-
-
-
- {{ event.location }}
- {% if display == "in list" %} {% else %}{% endif %}
-
- {% endif %}
- {% if event|need_complete_display:display %}
-
-
-
-
- {% if event.end_day %}Cet événement dure du {% else %}Cet événement a lieu le{% endif %}
- {% include "agenda_culturel/date-times-inc.html" with event=event %}
-
- {% endif %}
- {% elif display == "modal" %}
-
-
-
- {{ event.category | small_cat }} {{ event|picto_status }} {{ event.title }}
-
-
-
-
-
- {{ event.location }}
-
-
-
-
- {% if event.end_day %}du{% else %}le{% endif %}
- {% include "agenda_culturel/date-times-inc.html" with event=event %}
-
-
-
- {% else %}
-
- {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
- {{ event.category | small_cat }}
- {{ event|picto_status }} {{ event.title }}
-
-
-
- {% if event.end_day %}du{% else %}le{% endif %}
- {% include "agenda_culturel/date-times-inc.html" with event=event %}
-
-
-
-
-
- {{ event.location }}
-
-
- {% endif %}
-
- {% if event.image and display != "modal" %}
-
-
-
- {% endif %}
-
- {% if display in "in list by day" or display == "modal" %}
- {{ event.description |truncatewords:20 }}
- {% else %}
- {{ event.description }}
- {% endif %}
-
-
- {% if display == "modal" %}
-
- {% for tag in event.tags %}
- {{ tag | tag_button }}
- {% endfor %}
-
-
-
- {% else %}
-
-
-
- {% endif %}
-
-
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-day.html b/src/agenda_culturel/templates/agenda_culturel/page-day.html
index 2b84f88..86da489 100644
--- a/src/agenda_culturel/templates/agenda_culturel/page-day.html
+++ b/src/agenda_culturel/templates/agenda_culturel/page-day.html
@@ -34,16 +34,15 @@
@@ -51,7 +50,7 @@
{% if events %}
{% for event in events %}
- {% include "agenda_culturel/event-inc.html" with event=event display="in list by day" filter=filter %}
+ {% include "agenda_culturel/single-event/event-in-list-by-day-inc.html" with event=event filter=filter %}
{% endfor %}
{% else %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-event.html b/src/agenda_culturel/templates/agenda_culturel/page-event.html
index 834ff34..05e8303 100644
--- a/src/agenda_culturel/templates/agenda_culturel/page-event.html
+++ b/src/agenda_culturel/templates/agenda_culturel/page-event.html
@@ -10,6 +10,6 @@
{% block content %}
-{% include "agenda_culturel/event-inc.html" with event=event display="single" filter=filter %}
+{% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %}
{% endblock %}
\ No newline at end of file
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-month.html b/src/agenda_culturel/templates/agenda_culturel/page-month.html
index 9b90098..90708ab 100644
--- a/src/agenda_culturel/templates/agenda_culturel/page-month.html
+++ b/src/agenda_culturel/templates/agenda_culturel/page-month.html
@@ -33,14 +33,13 @@
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-week.html b/src/agenda_culturel/templates/agenda_culturel/page-week.html
index 72e7aac..a21a536 100644
--- a/src/agenda_culturel/templates/agenda_culturel/page-week.html
+++ b/src/agenda_culturel/templates/agenda_culturel/page-week.html
@@ -42,14 +42,13 @@
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-by-day-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-by-day-inc.html
new file mode 100644
index 0000000..4ac47d3
--- /dev/null
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-by-day-inc.html
@@ -0,0 +1,77 @@
+{% load static %}
+{% load cat_extra %}
+{% load utils_extra %}
+{% load event_extra %}
+{% load tag_extra %}
+
+
+ {% if event|can_show_start_time %}
+
+ {% if event.start_time %}
+ {{ event.start_time }}
+ {% endif %}
+
+ {% endif %}
+
+ {{ event.category | small_cat }}
+ {% if event.location %}{% endif %}
+
+ {% if event.location %}
+
+ {% picto_from_name "map-pin" %}
+
+ {{ event.location }}
+
+
+ {% endif %}
+
+ {% if event|need_complete_display:true %}
+ {% picto_from_name "calendar" %}
+
+ {% if event.end_day %}Cet événement dure du {% else %}Cet événement a lieu le{% endif %}
+ {% include "agenda_culturel/date-times-inc.html" with event=event %}
+
+ {% endif %}
+
+ {% if event.image %}
+
+
+
+ {% endif %}
+
+ {{ event.description |truncatewords:20 }}
+
+
+
+
+
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
new file mode 100644
index 0000000..2d712cc
--- /dev/null
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-list-inc.html
@@ -0,0 +1,71 @@
+{% load static %}
+{% load cat_extra %}
+{% load utils_extra %}
+{% load event_extra %}
+{% load tag_extra %}
+
+
+ {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
+
+ {{ event.category | small_cat }}
+ {% if event.location %}{% endif %}
+
+ {% if event.location %}
+
+ {% picto_from_name "map-pin" %}
+
+ {{ event.location }}
+
+
+ {% endif %}
+ {% if event|need_complete_display:false %}
+ {% picto_from_name "calendar" %}
+
+ {% if event.end_day %}Cet événement dure du {% else %}Cet événement a lieu le{% endif %}
+ {% include "agenda_culturel/date-times-inc.html" with event=event %}
+
+ {% endif %}
+
+ {% if event.image %}
+
+
+
+ {% endif %}
+
+ {{ event.description |truncatewords:20 }}
+
+
+
+ {% endif %}
+
+
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
new file mode 100644
index 0000000..efbe2fb
--- /dev/null
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html
@@ -0,0 +1,44 @@
+{% load static %}
+{% load cat_extra %}
+{% load utils_extra %}
+{% load event_extra %}
+{% load tag_extra %}
+
+
+
+
+ {{ event.category | small_cat }} {{ event|picto_status }} {{ event.title }}
+
+
+ {% picto_from_name "map-pin" %}
+ {{ event.location }}
+
+
+ {% picto_from_name "calendar" %}
+ {% if event.end_day %}du{% else %}le{% endif %}
+ {% include "agenda_culturel/date-times-inc.html" with event=event %}
+
+
+
+ {{ event.description |truncatewords:20 }}
+
+
+
+ {% for tag in event.tags %}
+ {{ tag | tag_button }}
+ {% endfor %}
+
+
+
+
+
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
new file mode 100644
index 0000000..af40b03
--- /dev/null
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
@@ -0,0 +1,56 @@
+{% load static %}
+{% load cat_extra %}
+{% load utils_extra %}
+{% load event_extra %}
+{% load tag_extra %}
+
+
+
+ {% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
+ {{ event.category | small_cat }}
+ {{ event|picto_status }} {{ event.title }}
+ {% picto_from_name "calendar" %}
+ {% if event.end_day %}du{% else %}le{% endif %}
+ {% include "agenda_culturel/date-times-inc.html" with event=event %}
+
+
+ {% picto_from_name "map-pin" %}
+ {{ event.location }}
+
+
+
+ {% if event.image %}
+
+
+
+ {% endif %}
+
+ {{ event.description }}
+
+
+
+
diff --git a/src/agenda_culturel/templates/agenda_culturel/tag.html b/src/agenda_culturel/templates/agenda_culturel/tag.html
index 04302e7..6670407 100644
--- a/src/agenda_culturel/templates/agenda_culturel/tag.html
+++ b/src/agenda_culturel/templates/agenda_culturel/tag.html
@@ -14,6 +14,6 @@
Les événements {{ tag }}
{% for event in events %}
-{% include "agenda_culturel/event-inc.html" with event=event display="in list" %}
+{% include "agenda_culturel/single-event/event-in-list-inc.html" with event=event %}
{% endfor %}
{% endblock %}
\ No newline at end of file
diff --git a/src/agenda_culturel/templatetags/event_extra.py b/src/agenda_culturel/templatetags/event_extra.py
index a567ea6..0d925fd 100644
--- a/src/agenda_culturel/templatetags/event_extra.py
+++ b/src/agenda_culturel/templatetags/event_extra.py
@@ -22,8 +22,8 @@ def can_show_start_time(event):
@register.filter
-def need_complete_display(event, display):
- return event.end_day and event.end_day != event.start_day and (event.start_time or event.end_time or display == "in list by day")
+def need_complete_display(event, display_full):
+ return event.end_day and event.end_day != event.start_day and (event.start_time or event.end_time or display_full)
@register.filter