From ea5372cae53a876081557c1c7595dc1ee7418123 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 24 Nov 2024 12:40:43 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20la=20performance=20des?= =?UTF-8?q?=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../categorise_events_form.html | 10 +- .../agenda_culturel/date-times-inc.html | 10 -- .../templates/agenda_culturel/day-inc.html | 83 -------------- .../agenda_culturel/event-location-inc.html | 14 --- .../agenda_culturel/organisation_detail.html | 2 - .../templates/agenda_culturel/page-month.html | 75 +++++++++++-- .../agenda_culturel/page-upcoming.html | 4 +- .../templates/agenda_culturel/page-week.html | 101 ++++++++++++++++-- .../agenda_culturel/place_detail.html | 2 - .../templates/agenda_culturel/place_list.html | 2 - .../single-event/event-elegant-inc.html | 20 +++- .../single-event/event-in-flat-list-inc.html | 21 +++- .../event-in-unknown-place-list-inc.html | 21 +++- .../single-event/event-modal-inc.html | 44 -------- .../single-event/event-single-inc.html | 20 +++- .../templates/agenda_culturel/tags.html | 2 +- 16 files changed, 246 insertions(+), 185 deletions(-) delete mode 100644 src/agenda_culturel/templates/agenda_culturel/date-times-inc.html delete mode 100644 src/agenda_culturel/templates/agenda_culturel/day-inc.html delete mode 100644 src/agenda_culturel/templates/agenda_culturel/event-location-inc.html delete mode 100644 src/agenda_culturel/templates/agenda_culturel/single-event/event-modal-inc.html diff --git a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html index f477b8a..42ce192 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html @@ -47,8 +47,14 @@

{% picto_from_name "calendar" %} {% if event.end_day and event.end_day != event.start_day %}du{% else %}le{% endif %} - {% include "agenda_culturel/date-times-inc.html" with event=event %} -

+ {{ event.start_day|date|frdate }} + {% if event.start_time %} {% if not event.end_day or event.end_day == event.start_day %}{% if event.end_time %}de{% else %}à{% endif %}{% endif %} + {{ event.start_time }} + {% endif %} + {% if event.end_day and event.end_day != event.start_day %} + au {% if event.end_day and event.end_day != event.start_day %}{{ event.end_day|date|frdate }}{% endif %} + {% endif %} + {% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %}

{{ event.description |linebreaks }}
diff --git a/src/agenda_culturel/templates/agenda_culturel/date-times-inc.html b/src/agenda_culturel/templates/agenda_culturel/date-times-inc.html deleted file mode 100644 index 26aa510..0000000 --- a/src/agenda_culturel/templates/agenda_culturel/date-times-inc.html +++ /dev/null @@ -1,10 +0,0 @@ -{% load utils_extra %} - -{{ event.start_day|date|frdate }} -{% if event.start_time %} {% if not event.end_day or event.end_day == event.start_day %}{% if event.end_time %}de{% else %}à{% endif %}{% endif %} - {{ event.start_time }} -{% endif %} -{% if event.end_day and event.end_day != event.start_day %} - au {% if event.end_day and event.end_day != event.start_day %}{{ event.end_day|date|frdate }}{% endif %} -{% endif %} -{% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %} \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/day-inc.html b/src/agenda_culturel/templates/agenda_culturel/day-inc.html deleted file mode 100644 index a7ae432..0000000 --- a/src/agenda_culturel/templates/agenda_culturel/day-inc.html +++ /dev/null @@ -1,83 +0,0 @@ - -{% load cat_extra %} -{% load event_extra %} -{% load utils_extra %} -{% load static %} - -{% with day.date|date:"Y-m-d" as daytag %} -{% with "date-"|add:daytag as daytag %} - -
- {% if day.is_today %} - - {% endif %} - - <{% if headers != "" %}{{ headers }}{% else %}h2{% endif %}>{{ day.date | date:"l j" }} - - {% if day.events %} - {% if resume == 1 %} -
    - {% for category, events in day.events_by_category_ordered %} -
  • {{ events.0.category | circle_cat }} - {{ events | length }} {{ category }}
  • - - - - {% endfor %} -
      - {% else %} -
        - {% for event in day.events %} -
      • {{ event.category | circle_cat:event.has_recurrences }} - {% if event.start_day == day.date and event.start_time %} - {{ event.start_time }} - {% endif %} - {{ event|picto_status }} {{ event.title }} - {{ event|tw_badge }} - - {% include "agenda_culturel/single-event/event-modal-inc.html" with event=event filter=filter %} - -
      • - {% endfor %} -
      - {% endif %} - {% endif %} -
    -
- -{% endwith %} -{% endwith %} \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/event-location-inc.html b/src/agenda_culturel/templates/agenda_culturel/event-location-inc.html deleted file mode 100644 index a237b1f..0000000 --- a/src/agenda_culturel/templates/agenda_culturel/event-location-inc.html +++ /dev/null @@ -1,14 +0,0 @@ - -{% if event.exact_location %} - {% if nolink %} - {{ event.exact_location.name }}, {{ event.exact_location.city }} - {% else %} - {{ event.exact_location.name }}, {{ event.exact_location.city }} - {% endif %} -{% else %} - {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %} - {{ event.location }} - {% else %} - {{ event.location }} - {% endif %} -{% endif %} \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/organisation_detail.html b/src/agenda_culturel/templates/agenda_culturel/organisation_detail.html index 18d5dec..1ca233e 100644 --- a/src/agenda_culturel/templates/agenda_culturel/organisation_detail.html +++ b/src/agenda_culturel/templates/agenda_culturel/organisation_detail.html @@ -7,7 +7,6 @@ {% load cat_extra %} {% load static %} {% load cache %} -{% load i18n %} {% load l10n %} {% block entete_header %} @@ -60,7 +59,6 @@ {{ object.description|safe }} - {% get_current_language as LANGUAGE_CODE %} {% with cache_timeout=user.is_authenticated|yesno:"30,600" %} {% cache cache_timeout organisation_list user.is_authenticated object page_obj.number past %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/page-month.html b/src/agenda_culturel/templates/agenda_culturel/page-month.html index 86aadb5..b8e7703 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-month.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-month.html @@ -1,9 +1,6 @@ {% extends "agenda_culturel/page.html" %} - -{% load i18n %} - {% load cat_extra %} {% load event_extra %} {% load utils_extra %} @@ -28,9 +25,8 @@ {% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %} - {% get_current_language as LANGUAGE_CODE %} {% with cache_timeout=user.is_authenticated|yesno:"30,600" %} - {% cache cache_timeout month user.is_authenticated calendar.firstdate filter.get_url LANGUAGE_CODE %} + {% cache cache_timeout month user.is_authenticated calendar.firstdate filter.get_url %}
@@ -64,12 +60,75 @@ {% endif %}
- {% for d in calendar.calendar_days_list %} + {% for day in calendar.calendar_days_list %} {% if forloop.counter0|divisibleby:7 %} {% if not forloop.first %}
{% endif %} - + {% endif %} - {% include "agenda_culturel/day-inc.html" with day=d resume=1 fixed_style=calendar.all_in_past filter=filter headers="h3" %} + + + + {% with day.date|date:"Y-m-d" as daytag %} + {% with "date-"|add:daytag as daytag %} + +
+ {% if day.is_today %} + + {% endif %} + +

{{ day.date | date:"l j" }} +

+ {% if day.events %} +
+ + {% endwith %} + {% endwith %} + {% endfor %}
{% if calendar.lastdate|shift_day:+1|not_after_last %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html b/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html index 87fc7ac..3694735 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-upcoming.html @@ -1,7 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% load i18n %} {% load cache %} {% load cat_extra %} {% load event_extra %} @@ -37,9 +36,8 @@ {% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=1 %} - {% get_current_language as LANGUAGE_CODE %} {% with cache_timeout=user.is_authenticated|yesno:"30,600" %} - {% cache cache_timeout upcoming user.is_authenticated calendar.firstdate filter.get_url calendar.calendar_days_list|length LANGUAGE_CODE %} + {% cache cache_timeout upcoming user.is_authenticated calendar.firstdate filter.get_url calendar.calendar_days_list|length %}