diff --git a/templates/macros.html b/templates/macros.html index f0ca499..57b3f44 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -279,6 +279,47 @@ https://www.flightradar24.com/data/flights/{{ flight.airline_detail.iata | lower {% endmacro %} +{% macro bus_row(item) %} + {% set url = item.url %} +
{{ item.depart.strftime("%a, %d %b %Y") }}
+
+ {% if g.user.is_authenticated and item.url %}{% endif %} + {{ item.from }} → {{ item.to }} + {% if g.user.is_authenticated and item.url %}{% endif %} +
+
{{ item.depart.strftime("%H:%M") }}
+
+ {% if item.arrive %} + {{ item.arrive.strftime("%H:%M") }} + {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} + {% endif %} +
+
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
+
{{ item.operator }}
+
+ {% if g.user.is_authenticated %} + {{ item.booking_reference }} + {% else %} + redacted + {% endif %} +
+
+
+
+ {% if item.distance %} + {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} + {% endif %} +
+
+ {% if g.user.is_authenticated and item.price and item.currency %} + {{ "{:,f}".format(item.price) }} {{ item.currency }} + {% if item.currency != "GBP" and item.currency in fx_rate %} + {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP + {% endif %} + {% endif %} +
+{% endmacro %} + {% macro ferry_row(item) %}
{{ item.depart.strftime("%a, %d %b %Y") }}
diff --git a/templates/trip_page.html b/templates/trip_page.html index 531c0ba..dbc3377 100644 --- a/templates/trip_page.html +++ b/templates/trip_page.html @@ -2,9 +2,9 @@ {% block title %}{{ trip.title }} ({{ display_date(trip.start) }}) - Edward Betts{% endblock %} -{% from "macros.html" import trip_link, display_datetime, display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row, ferry_row, coach_row with context %} +{% from "macros.html" import trip_link, display_datetime, display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row, ferry_row, coach_row, bus_row with context %} -{% set row = {"flight": flight_row, "train": train_row, "ferry": ferry_row, "coach": coach_row} %} +{% set row = {"flight": flight_row, "train": train_row, "ferry": ferry_row, "coach": coach_row, "bus": bus_row} %} {% macro next_and_previous() %}

@@ -271,7 +271,7 @@ {{ item.from }} → {{ item.to }} - {% elif item.type == "coach" %} + {% elif item.type == "coach" or item.type == "bus" %} 🚌 {{ item.from }} → @@ -322,7 +322,7 @@ {% endif %}

- {% elif item.type == "coach" %} + {% elif item.type == "coach" or item.type == "bus" %}
{{ display_datetime(item.depart) }} →