diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_subevent_calendar_week.html b/src/pretix/presale/templates/pretixpresale/event/fragment_subevent_calendar_week.html index 9813024fad..5ed2eb02fb 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_subevent_calendar_week.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_subevent_calendar_week.html @@ -40,3 +40,15 @@ {% include "pretixpresale/fragment_week_calendar.html" with show_avail=event.settings.event_list_availability %} +
+ + + {{ before|date:week_format }} + + + {{ after|date:week_format }} + + +
diff --git a/src/pretix/presale/templates/pretixpresale/fragment_js.html b/src/pretix/presale/templates/pretixpresale/fragment_js.html index 54acf7738d..e803071a6f 100644 --- a/src/pretix/presale/templates/pretixpresale/fragment_js.html +++ b/src/pretix/presale/templates/pretixpresale/fragment_js.html @@ -8,12 +8,12 @@ + - diff --git a/src/pretix/presale/templates/pretixpresale/fragment_week_calendar.html b/src/pretix/presale/templates/pretixpresale/fragment_week_calendar.html index b1161d1d69..c164ec9ab8 100644 --- a/src/pretix/presale/templates/pretixpresale/fragment_week_calendar.html +++ b/src/pretix/presale/templates/pretixpresale/fragment_week_calendar.html @@ -1,9 +1,11 @@ {% load i18n %}
{% for day in days %} -
-

{{ day.day_formatted }}

+
+ +

{{ day.day_formatted }}

+
{% if multiple_timezones %}
diff --git a/src/pretix/presale/views/organizer.py b/src/pretix/presale/views/organizer.py index b084e9ac03..9b71c7ba14 100644 --- a/src/pretix/presale/views/organizer.py +++ b/src/pretix/presale/views/organizer.py @@ -10,7 +10,7 @@ from django.db.models.functions import Coalesce, Greatest from django.http import Http404, HttpResponse from django.utils.decorators import method_decorator from django.utils.formats import date_format, get_format -from django.utils.timezone import now +from django.utils.timezone import now, get_current_timezone from django.views import View from django.views.decorators.cache import cache_page from django.views.generic import ListView, TemplateView @@ -427,6 +427,7 @@ def days_for_template(ebd, week): { 'day_formatted': date_format(day, day_format), 'date': day, + 'today': day == now().astimezone(get_current_timezone()).date(), 'events': sorted(ebd.get(day), key=sort_ev) if day in ebd else [] } for day in week.days() diff --git a/src/pretix/static/pretixpresale/js/ui/main.js b/src/pretix/static/pretixpresale/js/ui/main.js index 1c3ae92e8e..e89021c2c6 100644 --- a/src/pretix/static/pretixpresale/js/ui/main.js +++ b/src/pretix/static/pretixpresale/js/ui/main.js @@ -439,6 +439,14 @@ $(function () { } }); + // Week calendar + // On mobile, auto-collapse all days except today + if ($(window).width() < 992) { + $(".week-calendar .weekday:not(.today)").each(function () { + $(this).prop("open", false); + }); + } + // Lightbox lightbox.init(); }); @@ -480,4 +488,4 @@ function copy_answers(elements, answers) { } }); questions_toggle_dependent(true); -} \ No newline at end of file +} diff --git a/src/pretix/static/pretixpresale/scss/_calendar.scss b/src/pretix/static/pretixpresale/scss/_calendar.scss index aa9abd712b..da0684c9fe 100644 --- a/src/pretix/static/pretixpresale/scss/_calendar.scss +++ b/src/pretix/static/pretixpresale/scss/_calendar.scss @@ -80,6 +80,16 @@ h3 { margin-bottom: 5px; font-weight: bold; + cursor: pointer; + } + h3 .fa::before { + content: $fa-var-caret-right; + } + details[open] h3 .fa::before { + content: $fa-var-caret-down; + } + .events { + overflow: hidden; /* required for smooth toggle animation */ } .no-events { display: none; @@ -90,6 +100,14 @@ display: flex; flex-direction: row; + details[open] summary { + cursor: default; + pointer-events: none; + h3 .fa { + display: none; + } + } + .weekday { flex: 1; margin: 0 5px; @@ -128,4 +146,4 @@ .select-calendar-week-short { max-width: 50%; } -} \ No newline at end of file +}