Add day calendar to organizer page (#2100)

Co-authored-by: Richard Schreiber <wiffbi@gmail.com>
Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
Raphael Michel
2021-11-19 14:59:35 +01:00
committed by GitHub
parent f6f3bbcce6
commit 34e4f7e0fc
8 changed files with 938 additions and 14 deletions

View File

@@ -0,0 +1,123 @@
{% load i18n %}
{% load eventurl %}
<div class="day-calendar cal-size-{{ raster_to_shortest_ratio }}{% if no_headlines %} no-headlines{% endif %}"
data-raster-size="{{ raster_size }}"
data-duration="{{ calendar_duration }}"
data-start="{{ start|date:"c" }}"
data-timezone="{{ cal_tz }}">
<h3 aria-hidden="true" class="day-row-name"><span hidden>{% trans "Time of day" %}</span></h3>
<ul aria-hidden="true" class="day-timeline ticks">
{% for t in time_ticks %}
<li data-offset="{{ t.offset|date:"H:i" }}"
data-duration="{{ t.duration|date:"H:i" }}"
data-start="{{ t.start|date:"H:i" }}"
class="text-muted">{{ t.start|date:"TIME_FORMAT" }}</li>
{% endfor %}
</ul>
{% for series, collection in collections %}
<h3 class="day-row-name">
{% if series %}
<a href="{% eventurl series "presale:event.index" %}">
{{ series.name }}
</a>
{% else %}
<span class="sr-only">{% trans "Single events" context "day calendar" %}</span>
{% endif %}
</h3>
<ul class="day-timeline" data-concurrency="{{ collection.concurrency }}">
{% for t in time_ticks %}
{% if not forloop.counter|divisibleby:2 %}
<li data-offset="{{ t.offset|date:"H:i" }}"
data-duration="{{ t.duration|date:"H:i" }}" class="tick">&nbsp;</li>
{% endif %}
{% endfor %}
{% for event in collection.events %}
<li data-offset="{{ event.offset_rastered|date:"H:i" }}"
data-offset-shift="{{ event.offset_shift_start }}:{{ event.offset_shift_end }}"
data-duration="{{ event.duration_rastered }}"
data-concurrency="{{ event.concurrency }}">
<a class="event {% if event.continued %}continued{% else %} {% spaceless %}
{% if event.event.presale_is_running and show_avail %}
{% if event.event.best_availability_state == 100 %}
available
{% elif event.event.settings.waiting_list_enabled and event.event.best_availability_state >= 0 %}
waitinglist
{% elif event.event.best_availability_state == 20 %}
reserved
{% elif event.event.best_availability_state < 20 %}
soldout
{% endif %}
{% elif event.event.presale_is_running %}
running
{% elif event.event.presale_has_ended %}
over
{% elif event.event.settings.presale_start_show_date and event.event.presale_start %}
soon
{% else %}
soon
{% endif %}
{% endspaceless %}{% endif %}"
href="{{ event.url }}">
{% if show_names|default_if_none:True %}
<span class="event-name">
{{ event.event.name }}
</span>
{% endif %}
{% if not event.continued %}
{% if event.time %}
<span class="event-time" data-time="{{ event.event.date_from.isoformat }}"
data-timezone="{{ event.timezone }}" data-time-short>
<span class="fa fa-clock-o" aria-hidden="true"></span>
{% if not show_names|default_if_none:True %}
<strong>
{% endif %}
<time datetime="{{ event.time|date:"H:i" }}">{{ event.time|date:"TIME_FORMAT" }}</time>
{% if event.time_end %}
<span role="img" aria-label="{% trans "to" context "timerange" %}"></span>
<time datetime="{{ event.time_end|date:"H:i" }}">{{ event.time_end|date:"TIME_FORMAT" }}</time>
{% endif %}
{% if not show_names|default_if_none:True %}
</strong>
{% endif %}
{% if multiple_timezones %}
{{ event.timezone }}
{% endif %}
</span>
{% endif %}
<span class="event-status">
{% if event.event.presale_is_running and show_avail %}
{% if event.event.best_availability_state == 100 %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Book now" %}
{% elif event.event.settings.waiting_list_enabled and event.event.best_availability_state >= 0 %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Waiting list" %}
{% elif event.event.best_availability_state == 20 %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Reserved" %}
{% elif event.event.best_availability_state < 20 %}
{% if event.event.has_paid_item %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Sold out" %}
{% else %}
<span class="fa fa-ticket" aria-hidden="true"></span>
{% trans "Fully booked" %}
{% endif %}
{% endif %}
{% elif event.event.presale_is_running %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Book now" %}
{% elif event.event.presale_has_ended %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Sale over" %}
{% elif event.event.settings.presale_start_show_date and event.event.presale_start %}
<span class="fa fa-ticket" aria-hidden="true"></span>
{% blocktrans with start_date=event.event.presale_start|date:"SHORT_DATE_FORMAT" %}
from {{ start_date }}
{% endblocktrans %}
{% else %}
<span class="fa fa-ticket" aria-hidden="true"></span> {% trans "Soon" %}
{% endif %}
</span>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</div>

View File

@@ -20,21 +20,26 @@
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12 text-left flip">
<div class="btn-group" role="group">
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" %}" type="button" class="btn btn-default">
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" "date" "" %}" type="button" class="btn btn-default">
<span class="fa fa-list" aria-hidden="true"></span>
{% trans "List" %}
</a>
<a href="?{% url_replace request "style" "week" "old" "" "month" "" "year" "" %}" type="button"
<a href="?{% url_replace request "style" "week" "old" "" "month" "" "year" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Week" %}
</a>
<a href="?{% url_replace request "style" "calendar" "old" "" "week" "" %}"
<a href="?{% url_replace request "style" "calendar" "old" "" "week" "" "date" "" %}"
type="button"
class="btn btn-default active">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Month" %}
</a>
<a href="?{% url_replace request "style" "day" "week" "" "month" "" "old" "" "page" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-th" aria-hidden="true"></span>
{% trans "Day" %}
</a>
</div>
<a href="{% eventurl request.organizer "presale:organizer.ical" %}?{% url_replace request "locale" request.LANGUAGE_CODE "page" "" "old" "" "week" "" "style" "" "month" "" "year" "" %}"
class="btn btn-default">

View File

@@ -0,0 +1,101 @@
{% extends "pretixpresale/organizers/base.html" %}
{% load i18n %}
{% load rich_text %}
{% load eventurl %}
{% load urlreplace %}
{% block title %}{% trans "Event overview" %}{% endblock %}
{% block content %}
{% if organizer_homepage_text %}
<div>
{{ organizer_homepage_text | rich_text }}
</div>
{% endif %}
<h3>{{ date|date:"DATE_FORMAT" }}</h3>
<form class="form-inline" method="get" id="monthselform"
action="{% eventurl request.organizer "presale:organizer.index" %}">
{% for f, v in request.GET.items %}
{% if f != "date" %}
<input type="hidden" name="{{ f }}" value="{{ v }}">
{% endif %}
{% endfor %}
<div class="row">
<div class="col-sm-4 hidden-xs text-left flip">
<div class="btn-group" role="group">
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-list" aria-hidden="true"></span>
{% trans "List" %}
</a>
<a href="?{% url_replace request "style" "week" "month" "" "old" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Week" %}
</a>
<a href="?{% url_replace request "style" "calendar" "week" "" "old" "" "year" "" "date" "" %}"
type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Month" %}
</a>
<a href="?{% url_replace request "style" "day" "week" "" "month" "" "old" "" "page" "" %}" type="button"
class="btn btn-default active">
<span class="fa fa-th" aria-hidden="true"></span>
{% trans "Day" %}
</a>
</div>
<a href="{% eventurl request.organizer "presale:organizer.ical" %}?{% url_replace request "locale" request.LANGUAGE_CODE "page" "" "old" "" "week" "" "style" "" "month" "" "year" "" "date" "" %}"
class="btn btn-default">
<span class="fa fa-calendar-plus-o" aria-hidden="true"></span>
{% trans "iCal" %}
</a>
</div>
<div class="col-sm-4 col-xs-12 text-center">
<input class="datepickerfield form-control" value="{{ date|date:"SHORT_DATE_FORMAT" }}" name="date">
<button type="submit" class="js-hidden btn btn-default">
{% trans "Go" %}
</button>
</div>
<div class="col-sm-4 hidden-xs text-right flip">
{% if has_before %}
<a href="?{% url_replace request "date" before.date.isoformat %}"
class="btn btn-default">
<span class="fa fa-arrow-left" aria-hidden="true"></span>
{{ before|date:"SHORT_DATE_FORMAT" }}
</a>
{% endif %}
{% if has_after %}
<a href="?{% url_replace request "date" after.date.isoformat %}"
class="btn btn-default">
{{ after|date:"SHORT_DATE_FORMAT" }}
<span class="fa fa-arrow-right" aria-hidden="true"></span>
</a>
{% endif %}
</div>
</div>
</form>
{% include "pretixpresale/fragment_day_calendar.html" with show_avail=request.organizer.settings.event_list_availability %}
<div class="col-sm-4 visible-xs text-center">
{% if has_before %}
<a href="?{% url_replace request "date" before.date.isoformat %}"
class="btn btn-default">
<span class="fa fa-arrow-left" aria-hidden="true"></span>
{{ before|date:"SHORT_DATE_FORMAT" }}
</a>
{% endif %}
{% if has_after %}
<a href="?{% url_replace request "date" after.date.isoformat %}"
class="btn btn-default">
{{ after|date:"SHORT_DATE_FORMAT" }}
<span class="fa fa-arrow-right" aria-hidden="true"></span>
</a>
{% endif %}
</div>
{% if multiple_timezones %}
<div class="alert alert-info">
{% blocktrans trimmed %}
Note that the events in this view are in different timezones.
{% endblocktrans %}
</div>
{% endif %}
{% endblock %}

View File

@@ -21,22 +21,27 @@
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12 text-left flip">
<div class="btn-group" role="group">
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" %}" type="button"
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-list" aria-hidden="true"></span>
{% trans "List" %}
</a>
<a href="?{% url_replace request "style" "week" "month" "" "old" "" %}" type="button"
<a href="?{% url_replace request "style" "week" "month" "" "old" "" "date" "" %}" type="button"
class="btn btn-default active">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Week" %}
</a>
<a href="?{% url_replace request "style" "calendar" "week" "" "old" "" "year" "" %}"
<a href="?{% url_replace request "style" "calendar" "week" "" "old" "" "year" "" "date" "" %}"
type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Month" %}
</a>
<a href="?{% url_replace request "style" "day" "week" "" "month" "" "old" "" "page" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-th" aria-hidden="true"></span>
{% trans "Day" %}
</a>
</div>
<a href="{% eventurl request.organizer "presale:organizer.ical" %}?{% url_replace request "locale" request.LANGUAGE_CODE "page" "" "old" "" "week" "" "style" "" "month" "" "year" "" %}"
class="btn btn-default">

View File

@@ -28,21 +28,26 @@
{% endif %}
<div>
<div class="btn-group" role="group">
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" %}" type="button"
<a href="?{% url_replace request "style" "list" "week" "" "year" "" "month" "" "date" ""%}" type="button"
class="btn btn-default active">
<span class="fa fa-list" aria-hidden="true"></span>
{% trans "List" %}
</a>
<a href="?{% url_replace request "style" "week" "month" "" "old" "" "page" "" %}" type="button"
<a href="?{% url_replace request "style" "week" "month" "" "old" "" "page" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Week" %}
</a>
<a href="?{% url_replace request "style" "calendar" "week" "" "old" "" "page" "" %}" type="button"
<a href="?{% url_replace request "style" "calendar" "week" "" "old" "" "page" "" "date" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-calendar" aria-hidden="true"></span>
{% trans "Month" %}
</a>
<a href="?{% url_replace request "style" "day" "week" "" "month" "" "old" "" "page" "" %}" type="button"
class="btn btn-default">
<span class="fa fa-th" aria-hidden="true"></span>
{% trans "Day" %}
</a>
</div>
<a href="{% eventurl request.organizer "presale:organizer.ical" %}?{% url_replace request "locale" request.LANGUAGE_CODE "page" "" "old" "" "week" "" "style" "" "month" "" "year" "" %}"
class="btn btn-default">