diff --git a/templates/trip_page.html b/templates/trip_page.html index d5a909b..e4b57d6 100644 --- a/templates/trip_page.html +++ b/templates/trip_page.html @@ -72,6 +72,25 @@ {% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %} +
+

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 }}
+
+

{% if prev_trip %} previous: {{ trip_link(prev_trip) }} ({{ (trip.start - prev_trip.end).days }} days) diff --git a/web_view.py b/web_view.py index 98a3b56..f11fc68 100755 --- a/web_view.py +++ b/web_view.py @@ -253,6 +253,19 @@ def trip_page(start: str) -> str: if "geojson_filename" in route: route["geojson"] = agenda.trip.read_geojson(route.pop("geojson_filename")) + if trip.end: + countries = {c.alpha_2 for c in trip.countries} + holidays = [ + hol + for hol in agenda.holidays.get_all( + trip.start, trip.end, app.config["DATA_DIR"] + ) + if hol.country.upper() in countries + ] + holidays.sort(key=lambda item: (item.date, item.country)) + else: + holidays = [] + return flask.render_template( "trip_page.html", trip=trip, @@ -263,6 +276,7 @@ def trip_page(start: str) -> str: routes=routes, get_country=agenda.get_country, format_list_with_ampersand=format_list_with_ampersand, + holidays=holidays, )