annotate sat_templates/templates/bulma/calendar/daily.html @ 397:b313a7d343af

bulma (components/common): open external menu links in blank page (new tab).
author Goffi <goffi@goffi.org>
date Thu, 30 May 2024 17:08:21 +0200
parents 271b38ccd217
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
358
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
1 {# daily calendar view
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
2 @variable events(list[dict]): events to display
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3 @variable calendar_start(float): calendar start timestamp
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
4 @variable calendar_end(float): calendar end timestamp
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
5 #}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8 {% import 'components/block.html' as block with context %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 {% block body %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11 {{ icon_defs('calendar') }}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
12
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
13 <section class="section">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
14
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 <div class="content has-items-centered is-flex">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16 {{ component.action_button(url_event_new) }}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
17 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
18
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
20 <h1 class="title has-text-centered">{{ calendar_start|date_fmt('full', date_only=True) }}</h1>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
21 <div class="columns">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
22 <div class="column">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
23 <div class="time-and-events">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
24 <div class="time-rows" aria-hidden="true">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
25 {% for hour in range(calendar_start|timestamp_to_hour, calendar_end|timestamp_to_hour + 1) %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26 {% for minute in [0, 30] %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 <div class="time-row {% if minute == 0 %}hour-row{% else %}half-hour-row{% endif %}">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28 <span class="time-text" >{{ "%02d:%02d"|format(hour, minute) }}</span>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29 <div class="line"></div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31 {% endfor %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
32 {% endfor %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
33 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
34 {% if events %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
35 {% for event in events %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
36 {% if event.end > calendar_start and event.start < calendar_end %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
37 {% set event_start = event.start|date_fmt(tz_name=tz_name) %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
38 {% set event_end = event.end|date_fmt(tz_name=tz_name) %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
39 {% set event_duration = event.start|delta_to_human(event.end) %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
40 {% set ns = namespace(event_classes = []) %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
41 {% if event.start < calendar_start %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
42 {% set ns.event_classes = ns.event_classes + ['already-started'] %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
43 {% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
44 {% if event.end > calendar_end %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
45 {% set ns.event_classes = ns.event_classes + ['not-finished'] %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
46 {% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
47 {% for other_event in events %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
48 {% if event != other_event and event.start < other_event.end and event.end > other_event.start %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
49 {% set ns.event_classes = ns.event_classes + ['is-conflicting'] %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
50 {% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
51 {% endfor %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
52 {% set event_top = [(((event.start - calendar_start) / 1800 * 30) + 15), 0]|max|int %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
53 {% set event_height = [((event.end - event.start) / 1800 * 30), ]|min|int %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
54 <div class="event-box {{ ns.event_classes|join(' ') }}" style="top: {{ event_top }}px; height: {{ event_height }}px; max-height: calc(100% - {{event_top}}px);">
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
55 <span class="event-name">{{ event.name[""] }}</span>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
56 <br>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
57 {{ event_start }} - {{ event_end }} ({{ event_duration }})
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
58 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
59 {% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
60 {% endfor %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
61 {% endif %}
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
62 <div id="current-time-line" aria-hidden="true" hidden></div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
63 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
64 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
65 </div>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
66
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
67
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
68 </section>
271b38ccd217 bulma (calendar): calendar and its daily view, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
69 {% endblock body %}