Next trip and previous trip links on trip pages

Closes: #110
This commit is contained in:
Edward Betts 2024-01-14 12:29:39 +00:00
parent 36b5d38274
commit fbee775f5b
3 changed files with 19 additions and 3 deletions

View file

@ -3,6 +3,10 @@
{% macro display_date(dt) %}{{ dt.strftime("%a %-d %b %Y") }}{% endmacro %}
{% macro display_date_no_year(dt) %}{{ dt.strftime("%a %-d %b") }}{% endmacro %}
{% macro trip_link(trip) %}
<a href="{{ url_for("trip_page", start=trip.start.isoformat()) }}">{{ trip.title }}</a>
{% endmacro %}
{% macro conference_row(item, badge) %}
{% set country = get_country(item.country) if item.country else None %}
<div class="grid-item text-end">{{ item.start.strftime("%a, %d %b %Y") }}</div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% from "macros.html" import display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row with context %}
{% from "macros.html" import trip_link, display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row with context %}
{% set row = { "flight": flight_row, "train": train_row } %}
@ -77,6 +77,11 @@
{% endfor %}
</div>
<p>
{% if prev_trip %}previous: {{ trip_link(prev_trip) }}{% endif %}
{% if next_trip %}next: {{ trip_link(next_trip) }}{% endif %}
</p>
{% if coordinates %}
<div id="map"></div>
{% endif %}