From 72e7945fbe12e85a875ec77d2fa5e04cd4e2ed35 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 23 Jan 2024 15:55:28 +0000 Subject: [PATCH] Change layout of trip page --- agenda/conference.py | 2 + templates/trip_page.html | 176 ++++++++++++++++++++++++++------------- 2 files changed, 121 insertions(+), 57 deletions(-) diff --git a/agenda/conference.py b/agenda/conference.py index 24ed552..19e77bf 100644 --- a/agenda/conference.py +++ b/agenda/conference.py @@ -35,6 +35,8 @@ class Conference: longitude: float | None = None cfp_end: date | None = None cfp_url: str | None = None + free: bool | None = None + hackathon: bool | None = None @property def display_name(self) -> str: diff --git a/templates/trip_page.html b/templates/trip_page.html index a7a6169..a9bf8a8 100644 --- a/templates/trip_page.html +++ b/templates/trip_page.html @@ -44,7 +44,7 @@ } #map { - height: 80vh; + height: 90vh; } @@ -53,75 +53,138 @@ {% set end = trip.end %} {% block content %} -
-

{{ trip.title }}({{ display_date(trip.start) }})

-
Countries: {{ trip.countries_str }}
- {% if end %} -
- Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }} - ({{ (end - trip.start).days }} nights) +
+
+

{{ trip.title }}

+

+ {% if end %} + {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }} + ({{ (end - trip.start).days }} nights) + {% else %} + {{ display_date_no_year(trip.start) }} (end date missing) + {% endif %} +

+ +
+
Countries: {{ trip.countries_str }}
+ + {% set delta = human_readable_delta(trip.start) %} + {% if delta %} +
How long until trip: {{ delta }}
+ {% endif %}
- {% else %} -
Start: {{ display_date_no_year(trip.start) }} (end date missing)
- {% endif %} - {% set delta = human_readable_delta(trip.start) %} - {% if delta %} -
{{ delta }} time
- {% endif %} + {% for item in trip.conferences %} + {% set country = get_country(item.country) if item.country else None %} +
+
+
+ {{ item.name }} + + {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }} + +
+

+ Topic: {{ item.topic }} + | Venue: {{ item.venue }} + | Location: {{ item.location }} + {% if country %} + {{ country.flag }} + {% elif item.online %} + 💻 Online + {% else %} + + country code {{ item.country }} not found + + {% endif %} + {% if item.free %} + | free to attend + {% elif item.price and item.currency %} + | price: {{ item.price }} {{ item.currency }} + {% endif %} +

+
+
+ {% endfor %} -
- {% for conf in trip.conferences %} {{ conference_row(conf, "going") }} {% endfor %} -
+ {% for item in trip.accommodation %} + {% set country = get_country(item.country) if item.country else None %} + {% set nights = (item.to.date() - item.from.date()).days %} +
+
+
+ {% if item.operator %}{{ item.operator }}: {% endif %} + {{ item.name }} + + {{ display_date_no_year(item.from) }} to {{ display_date_no_year(item.to) }} + ({% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %}) + +
+

+ Address: {{ item.address }} + | Location: {{ item.location }} + {% if country %} + {{ country.flag }} + {% elif item.online %} + 💻 Online + {% else %} + + country code {{ item.country }} not found + + {% endif %} + {% if item.price and item.currency %} + | price: {{ item.price }} {{ item.currency }} + {% endif %} +

+
+
+ {% endfor %} -
- {% for conf in trip.accommodation %} {{ accommodation_row(conf, "going") }} {% endfor %} -
+
+ {% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %} +
-
- {% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %} -
+
+

Holidays

+ {% if holidays %} - {% if holidays %} -
-

Holidays

+ + {% for item in holidays %} + {% set country = get_country(item.country) %} + + {% if loop.first or item.date != loop.previtem.date %} + + {% else %} + + {% endif %} + + + + {% endfor %} +
{{ display_date(item.date) }}{{ country.flag }} {{ country.name }}{{ item.display_name }}
+ {% else %} +

No public holidays during trip.

+ {% endif %} +
- - {% for item in holidays %} - {% set country = get_country(item.country) %} - - {% if loop.first or item.date != loop.previtem.date %} - - {% else %} - +

+ {% if prev_trip %} + previous: {{ trip_link(prev_trip) }} ({{ (trip.start - prev_trip.end).days }} days) {% endif %} -

- - - {% endfor %} -
{{ display_date(item.date) }}{{ country.flag }} {{ country.name }}{{ item.display_name }}
+ {% if next_trip %} + next: {{ trip_link(next_trip) }} ({{ (next_trip.start - trip.end).days }} days) + {% endif %} +

+ +
+
+
- {% endif %} - -

- {% if prev_trip %} - previous: {{ trip_link(prev_trip) }} ({{ (trip.start - prev_trip.end).days }} days) - {% endif %} - {% if next_trip %} - next: {{ trip_link(next_trip) }} ({{ (next_trip.start - trip.end).days }} days) - {% endif %} -

- - {% if coordinates %} -
- {% endif %} -
{% endblock %} {% block scripts %} -{% if coordinates %} @@ -137,5 +200,4 @@ var routes = {{ routes | tojson }}; build_map("map", coordinates, routes); -{% endif %} {% endblock %}