From 14c25e16ed612e08fb45c2f499be44bbb677e05a Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 23 Jan 2024 16:28:20 +0000 Subject: [PATCH] Add next and previous links at top of trip page --- templates/trip_page.html | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/templates/trip_page.html b/templates/trip_page.html index a9bf8a8..001ba6e 100644 --- a/templates/trip_page.html +++ b/templates/trip_page.html @@ -6,6 +6,17 @@ {% set row = { "flight": flight_row, "train": train_row } %} +{% macro next_and_previous() %} +

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

+{% endmacro %} + {% block style %} {% if coordinates %} @@ -55,6 +66,7 @@ {% block content %}
+ {{ next_and_previous() }}

{{ trip.title }}

{% if end %} @@ -167,14 +179,7 @@ {% 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 %} -

+ {{ next_and_previous() }}