diff --git a/templates/trip_page.html b/templates/trip_page.html
new file mode 100644
index 0000000..43b9ed5
--- /dev/null
+++ b/templates/trip_page.html
@@ -0,0 +1,71 @@
+{% extends "base.html" %}
+
+{% from "macros.html" import display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row with context %}
+
+{% set row = { "flight": flight_row, "train": train_row } %}
+
+{% block style %}
+{% set conference_column_count = 6 %}
+{% set accommodation_column_count = 7 %}
+{% set travel_column_count = 7 %}
+
+{% endblock %}
+
+{% 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) }}
+ {% else %}
+
Start: {{ display_date_no_year(trip.start) }} (end date missing)
+ {% endif %}
+
+ {% for conf in trip.conferences %}
+ {{ conference_row(conf, "going") }}
+ {% endfor %}
+
+
+
+ {% for conf in trip.accommodation %}
+ {{ accommodation_row(conf, "going") }}
+ {% endfor %}
+
+
+
+ {% for item in trip.travel %}
+ {{ row[item.type](item) }}
+ {% endfor %}
+
+
+ {#
{{ trip | pprint }}
#}
+
+
+{% endblock %}
diff --git a/templates/trips.html b/templates/trips.html
index e2c45bd..7da70cb 100644
--- a/templates/trips.html
+++ b/templates/trips.html
@@ -44,7 +44,9 @@
{% for trip in items %}
{% set end = trip.end %}
-
{{ trip.title }} ({{ display_date(trip.start) }})
+
+ {{ 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) }}
diff --git a/web_view.py b/web_view.py
index 2ee8b01..058f09e 100755
--- a/web_view.py
+++ b/web_view.py
@@ -170,8 +170,24 @@ def build_trip_list() -> list[Trip]:
data_dir = app.config["PERSONAL_DATA"]
+ stations = travel.parse_yaml("stations", data_dir)
+ by_name = {station["name"]: station for station in stations}
+
+ trains = load_travel("train")
+ for train in trains:
+ assert train["from"] in by_name
+ assert train["to"] in by_name
+ train["from_station"] = by_name[train["from"]]
+ train["to_station"] = by_name[train["to"]]
+
+ for leg in train["legs"]:
+ assert leg["from"] in by_name
+ assert leg["to"] in by_name
+ leg["from_station"] = by_name[train["from"]]
+ leg["to_station"] = by_name[train["to"]]
+
travel_items = sorted(
- load_travel("flight") + load_travel("train"), key=operator.itemgetter("depart")
+ load_travel("flight") + trains, key=operator.itemgetter("depart")
)
data = {
@@ -219,5 +235,20 @@ def trip_list() -> str:
)
+@app.route("/trip/
")
+def trip_page(start: str) -> str:
+ trip_list = build_trip_list()
+ today = date.today()
+
+ trip = next((trip for trip in trip_list if trip.start.isoformat() == start), None)
+ return flask.render_template(
+ "trip_page.html",
+ trip=trip,
+ today=today,
+ get_country=agenda.get_country,
+ format_list_with_ampersand=format_list_with_ampersand,
+ )
+
+
if __name__ == "__main__":
app.run(host="0.0.0.0")