# HG changeset patch # User Goffi # Date 1680188762 -7200 # Node ID 271b38ccd217a223bd04af0b40540f73d8f8d6a3 # Parent 6c21a9857e08c2b0126f35e4d63974540fe5c552 bulma (calendar): calendar and its daily view, first draft diff -r 6c21a9857e08 -r 271b38ccd217 sat_templates/templates/bulma/calendar/daily.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sat_templates/templates/bulma/calendar/daily.html Thu Mar 30 17:06:02 2023 +0200 @@ -0,0 +1,69 @@ +{# daily calendar view + @variable events(list[dict]): events to display + @variable calendar_start(float): calendar start timestamp + @variable calendar_end(float): calendar end timestamp +#} + +{% if not embedded %}{% extends 'base/base.html' %}{% endif %} +{% import 'components/block.html' as block with context %} + +{% block body %} +{{ icon_defs('calendar') }} + +
+ +
+ {{ component.action_button(url_event_new) }} +
+ + +

{{ calendar_start|date_fmt('full', date_only=True) }}

+
+
+
+ + {% if events %} + {% for event in events %} + {% if event.end > calendar_start and event.start < calendar_end %} + {% set event_start = event.start|date_fmt(tz_name=tz_name) %} + {% set event_end = event.end|date_fmt(tz_name=tz_name) %} + {% set event_duration = event.start|delta_to_human(event.end) %} + {% set ns = namespace(event_classes = []) %} + {% if event.start < calendar_start %} + {% set ns.event_classes = ns.event_classes + ['already-started'] %} + {% endif %} + {% if event.end > calendar_end %} + {% set ns.event_classes = ns.event_classes + ['not-finished'] %} + {% endif %} + {% for other_event in events %} + {% if event != other_event and event.start < other_event.end and event.end > other_event.start %} + {% set ns.event_classes = ns.event_classes + ['is-conflicting'] %} + {% endif %} + {% endfor %} + {% set event_top = [(((event.start - calendar_start) / 1800 * 30) + 15), 0]|max|int %} + {% set event_height = [((event.end - event.start) / 1800 * 30), ]|min|int %} +
+ {{ event.name[""] }} +
+ {{ event_start }} - {{ event_end }} ({{ event_duration }}) +
+ {% endif %} + {% endfor %} + {% endif %} + +
+
+
+ + +
+{% endblock body %} diff -r 6c21a9857e08 -r 271b38ccd217 sat_templates/templates/bulma/components/menu_labels.html --- a/sat_templates/templates/bulma/components/menu_labels.html Thu Mar 30 17:05:13 2023 +0200 +++ b/sat_templates/templates/bulma/components/menu_labels.html Thu Mar 30 17:06:02 2023 +0200 @@ -10,6 +10,7 @@ 'list_item_new': _('Create new list item'), 'chat': _('Chat'), 'files': _('Files sharing'), + 'calendar': _('Calendar'), 'events': _('Events'), 'event_new': _('Create an event'), 'photos': _('Photos albums'), diff -r 6c21a9857e08 -r 271b38ccd217 sat_templates/templates/bulma/static/calendar.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sat_templates/templates/bulma/static/calendar.css Thu Mar 30 17:06:02 2023 +0200 @@ -0,0 +1,72 @@ + +.time-and-events { + position: relative; + width: 100%; +} + +.hour-row, +.half-hour-row { + position: relative; +} + +.half-hour-row .time-text { + font-weight: lighter; +} + +.time-row { + display: flex; + align-items: center; + height: 30px; +} + +.time-text { + margin-right: 5px; +} + +.line { + flex-grow: 1; + height: 1px; + background-color: black; +} + +.half-hour-row .line { + background-color: #D3D3D3; +} + +.event-box { + position: absolute; + left: 3em; + right: 0; + max-width: 800px; + z-index: 2; + padding: 0.25em; + border-radius: 0.25em; + overflow-y: auto; + background-color: #ADD8E6; + border: 1px solid #00008B; +} + +.event-name { + font-weight: bold; +} + +.event-box.is-conflicting { + background-color: red; +} + +.event-box.already-started { + border-top: 1px dotted; +} + +.event-box.not-finished { + border-bottom: 1px dotted; +} + +#current-time-line { + position: absolute; + left: 0; + right: 0; + height: 1px; + background-color: red; + z-index: 3; +}