trip: redesign itinerary display and add trip list macro
- Add render_trip_element macro to macros.html; use it in trip_item for the trip list page, giving a consistent one-line-per-element format with emoji, route, times, duration, operator, distance, and CO₂ - Redesign trip_page.html itinerary: day headers use date-only (no year), condense check-out to a single accent line, show time-only on transport cards, humanise duration (Xh Ym), km-only distance, add CO₂ for all transport modes, fix seat display for integer seat values - Fix UndefinedError on /trip/past caused by absent 'arrive' key (Jinja2 Undefined is truthy) and date-only depart/arrive fields (no .date()) - Improve mobile map layout: text column before map in HTML order, reduce mobile map heights, hide toggle button on mobile - Add trips.css with design system (Playfair Display / Source Sans 3 / JetBrains Mono, navy/gold/amber palette, card variants by type) - Add tests/test_trip_list_render.py covering the rendering edge cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b3975dad3a
commit
574b4feb1f
5 changed files with 935 additions and 338 deletions
|
|
@ -6,6 +6,14 @@
|
|||
|
||||
{% set row = {"flight": flight_row, "train": train_row, "ferry": ferry_row, "coach": coach_row, "bus": bus_row} %}
|
||||
|
||||
{% macro trip_duration(depart, arrive) -%}
|
||||
{%- set mins = ((arrive - depart).total_seconds() // 60) | int -%}
|
||||
{%- set h = mins // 60 -%}
|
||||
{%- set m = mins % 60 -%}
|
||||
{%- if h %}{{ h }}h {% endif -%}
|
||||
{%- if m %}{{ m }}m{% elif h %}0m{% endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro next_and_previous() %}
|
||||
<p>
|
||||
{% if prev_trip %}
|
||||
|
|
@ -22,6 +30,7 @@
|
|||
{% if coordinates %}
|
||||
<link rel="stylesheet" href="{{ url_for("static", filename="leaflet/leaflet.css") }}">
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ url_for("static", filename="css/trips.css") }}">
|
||||
|
||||
{% set conference_column_count = 7 %}
|
||||
{% set accommodation_column_count = 7 %}
|
||||
|
|
@ -57,19 +66,28 @@
|
|||
}
|
||||
|
||||
.full-window-map {
|
||||
position: fixed; /* Make the map fixed position */
|
||||
position: fixed;
|
||||
top: 56px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999; /* Make sure it sits on top */
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#toggleMapSize {
|
||||
position: fixed; /* Fixed position */
|
||||
top: 66px; /* 10px from the top */
|
||||
right: 10px; /* 10px from the right */
|
||||
z-index: 10000; /* Higher than the map's z-index */
|
||||
position: fixed;
|
||||
top: 66px;
|
||||
right: 10px;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
#toggleMapSize {
|
||||
display: none;
|
||||
}
|
||||
.half-map {
|
||||
height: 50vh;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -85,8 +103,8 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="m-3">
|
||||
{{ next_and_previous() }}
|
||||
<h1>{{ trip.title }}</h1>
|
||||
<div class="trip-prev-next">{{ next_and_previous() }}</div>
|
||||
<h1 class="trip-page-title">{{ trip.title }}</h1>
|
||||
<p class="lead">
|
||||
{% if end %}
|
||||
{{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
|
||||
|
|
@ -97,8 +115,11 @@
|
|||
</p>
|
||||
|
||||
<div class="mb-3">
|
||||
{# <div>Countries: {{ trip.countries_str }}</div> #}
|
||||
<div>Locations: {{ trip.locations_str }}</div>
|
||||
<ul class="list-unstyled trip-countries">
|
||||
{% for location, country in trip.locations() %}
|
||||
<li>{{ country.flag if trip.show_flags }} {{ location }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if destination_times %}
|
||||
<div class="mt-2">
|
||||
<strong>Destination time zones</strong>
|
||||
|
|
@ -123,31 +144,24 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="trip-stats">
|
||||
{% if total_distance %}
|
||||
<div>Total distance:
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(total_distance, total_distance / 1.60934) }}
|
||||
</div>
|
||||
<span class="trip-stat">{{ "{:,.0f} km / {:,.0f} mi".format(total_distance, total_distance / 1.60934) }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if distances_by_transport_type %}
|
||||
{% for transport_type, distance in distances_by_transport_type %}
|
||||
<div>{{ transport_type | title }} distance:
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(distance, distance / 1.60934) }}
|
||||
</div>
|
||||
<span class="trip-stat">{{ transport_type | title }}: {{ "{:,.0f} km".format(distance) }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if total_co2_kg %}
|
||||
<div>Total CO₂: {{ "{:,.1f}".format(total_co2_kg) }} kg</div>
|
||||
<span class="trip-stat">CO₂ {{ "{:,.1f}".format(total_co2_kg) }} kg</span>
|
||||
{% endif %}
|
||||
|
||||
{% if co2_by_transport_type %}
|
||||
{% for transport_type, co2_kg in co2_by_transport_type %}
|
||||
<div>{{ transport_type | title }} CO₂:
|
||||
{{ "{:,.1f}".format(co2_kg) }} kg
|
||||
</div>
|
||||
<span class="trip-stat">{{ transport_type | title }} CO₂ {{ "{:,.1f}".format(co2_kg) }} kg</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
{% set delta = human_readable_delta(trip.start) %}
|
||||
|
|
@ -175,75 +189,227 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% for item in trip.conferences %}
|
||||
{% set country = get_country(item.country) if item.country else None %}
|
||||
<div class="card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="{{ item.url }}">{{ item.name }}</a>
|
||||
<small class="text-muted">
|
||||
{{ display_conf_date_no_year(item.attend_start if item.attend_start else item.start) }} to {{ display_conf_date_no_year(item.attend_end if item.attend_end else item.end) }}
|
||||
{% if item.attend_start or item.attend_end %}
|
||||
(full conference: {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }})
|
||||
{% endif %}
|
||||
</small>
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
<strong>Topic:</strong> {{ item.topic }}
|
||||
<strong>Venue:</strong> {{ item.venue }}
|
||||
<strong>Location:</strong> {{ item.location }}
|
||||
{% if country %}
|
||||
{{ country.flag if trip.show_flags }}
|
||||
{% elif item.online %}
|
||||
💻 Online
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">
|
||||
country code <strong>{{ item.country }}</strong> not found
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if item.free %}
|
||||
<span class="badge bg-success text-nowrap">free to attend</span>
|
||||
{% elif item.price and item.currency %}
|
||||
<span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{# ---- Chronological itinerary ---- #}
|
||||
{% for day, day_elements in trip.elements_grouped_by_day() %}
|
||||
{% set weather = trip_weather.get(day.isoformat()) if trip_weather else None %}
|
||||
<h4 class="trip-day-header">
|
||||
{{ display_date_no_year(day) }}
|
||||
{% if weather %}
|
||||
<span class="trip-weather-inline">
|
||||
<img src="https://openweathermap.org/img/wn/{{ weather.icon }}.png"
|
||||
alt="{{ weather.status }}" title="{{ weather.detailed_status }}" width="18" height="18">
|
||||
{{ weather.temp_min }}–{{ weather.temp_max }}°C
|
||||
<span class="fw-normal fst-italic">{{ weather.detailed_status }}</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if g.user.is_authenticated and day <= today %}
|
||||
<a class="ms-2 small fw-normal" href="https://photos.4angle.com/search?query=%7B%22takenAfter%22%3A%22{{day}}T00%3A00%3A00.000Z%22%2C%22takenBefore%22%3A%22{{day}}T23%3A59%3A59.999Z%22%7D">photos</a>
|
||||
{% endif %}
|
||||
</h4>
|
||||
|
||||
{% for item in trip.accommodation %}
|
||||
{% set country = get_country(item.country) if item.country else None %}
|
||||
{% set nights = (item.to.date() - item.from.date()).days %}
|
||||
<div class="card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
{% if item.operator %}{{ item.operator }}: {% endif %}
|
||||
<a href="{{ item.url }}">{{ item.name }}</a>
|
||||
<small class="text-muted">
|
||||
{{ display_date_no_year(item.from) }} to {{ display_date_no_year(item.to) }}
|
||||
({% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %})
|
||||
</small>
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
<strong>Address:</strong> {{ item.address }}
|
||||
<strong>Location:</strong> {{ item.location }}
|
||||
{% if country %}
|
||||
{{ country.flag if trip.show_flags }}
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">
|
||||
country code <strong>{{ item.country }}</strong> not found
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if g.user.is_authenticated and item.price and item.currency %}
|
||||
<span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% for e in day_elements %}
|
||||
|
||||
{% if e.element_type == "conference" %}
|
||||
{% set item = e.detail %}
|
||||
{% set country = get_country(item.country) if item.country else None %}
|
||||
<div class="trip-conference-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="{{ item.url }}">{{ item.name }}</a>
|
||||
<small class="text-muted">
|
||||
{{ display_conf_date_no_year(item.attend_start if item.attend_start else item.start) }} to {{ display_conf_date_no_year(item.attend_end if item.attend_end else item.end) }}
|
||||
{% if item.attend_start or item.attend_end %}
|
||||
(full conference: {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }})
|
||||
{% endif %}
|
||||
</small>
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
<strong>Topic:</strong> {{ item.topic }}
|
||||
<strong>Venue:</strong> {{ item.venue }}
|
||||
<strong>Location:</strong> {{ item.location }}
|
||||
{% if country %}
|
||||
{{ country.flag if trip.show_flags }}
|
||||
{% elif item.online %}
|
||||
💻 Online
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">country code <strong>{{ item.country }}</strong> not found</span>
|
||||
{% endif %}
|
||||
{% if item.free %}
|
||||
<span class="badge bg-success text-nowrap">free to attend</span>
|
||||
{% elif item.price and item.currency %}
|
||||
<span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif e.element_type == "check-in" %}
|
||||
{% set item = e.detail %}
|
||||
{% set country = get_country(item.country) if item.country else None %}
|
||||
{% set nights = (item.to.date() - item.from.date()).days %}
|
||||
<div class="trip-accommodation-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
{{ e.get_emoji() }}
|
||||
<a href="{{ item.url }}">{{ item.name }}</a>
|
||||
{% if item.operator and item.operator != item.name %}<small class="text-muted fw-normal">{{ item.operator }}</small>{% endif %}
|
||||
<small class="text-muted">({% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %})</small>
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
{{ item.location }}
|
||||
{% if country %}
|
||||
{{ country.flag if trip.show_flags }}
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">country code <strong>{{ item.country }}</strong> not found</span>
|
||||
{% endif %}
|
||||
{% if item.address %} · {{ item.address }}{% endif %}
|
||||
{% if g.user.is_authenticated and item.price and item.currency %}
|
||||
<span class="badge bg-info text-nowrap ms-1">{{ item.price }} {{ item.currency }}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif e.element_type == "check-out" %}
|
||||
{% set item = e.detail %}
|
||||
<div class="trip-checkout">
|
||||
{{ e.get_emoji() }} Check out: <a href="{{ item.url }}">{{ item.name }}</a>
|
||||
{% if item.operator and item.operator != item.name %}<span class="text-muted small">{{ item.operator }}</span>{% endif %}
|
||||
</div>
|
||||
|
||||
{% elif e.element_type == "flight" %}
|
||||
{% set item = e.detail %}
|
||||
{% set full_flight_number = item.airline_code + item.flight_number %}
|
||||
{% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
|
||||
{% set is_overnight = item.arrive and item.depart.date() != item.arrive.date() %}
|
||||
<div class="trip-transport-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
✈️
|
||||
{{ item.from_airport.name }} ({{ item.from_airport.iata }})
|
||||
→
|
||||
{{ item.to_airport.name }} ({{ item.to_airport.iata }})
|
||||
</h5>
|
||||
<div class="card-text">
|
||||
<div>
|
||||
<span>{{ item.airline_name }}</span>
|
||||
<span class="text-muted small">{{ full_flight_number }}</span>
|
||||
· {{ item.depart.strftime("%H:%M") }}
|
||||
{% if item.arrive %}
|
||||
→ {{ item.arrive.strftime("%H:%M") }}{% if is_overnight %} <span class="text-muted small">+1 day</span>{% endif %}
|
||||
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
|
||||
{% endif %}
|
||||
{% if item.distance %}
|
||||
<span class="text-muted">🌍 {{ "{:,.0f} km".format(item.distance) }}</span>
|
||||
{% endif %}
|
||||
{% if item.co2_kg is defined and item.co2_kg is not none %}
|
||||
<span class="text-muted">CO₂ {{ "{:,.1f}".format(item.co2_kg) }} kg</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="small mt-1">
|
||||
<a href="https://www.flightradar24.com/data/flights/{{ item.airline_detail.iata | lower }}{{ item.flight_number }}">flightradar24</a>
|
||||
· <a href="https://uk.flightaware.com/live/flight/{{ full_flight_number }}">FlightAware</a>
|
||||
· <a href="{{ radarbox_url }}">radarbox</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif e.element_type == "train" %}
|
||||
{% set item = e.detail %}
|
||||
{% set is_overnight = item.depart.date() != item.arrive.date() %}
|
||||
<div class="trip-transport-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
{% if is_overnight %}🌙{% else %}🚆{% endif %}
|
||||
{{ item.from }} → {{ item.to }}
|
||||
{% if item.operator %}<small class="text-muted fw-normal">{{ item.operator }}</small>{% endif %}
|
||||
{% if is_overnight %}<span class="badge bg-secondary text-nowrap ms-1">Night train</span>{% endif %}
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
{{ item.depart.strftime("%H:%M") }}
|
||||
→ {{ item.arrive.strftime("%H:%M") }}{% if is_overnight %} <span class="text-muted small">+1 day</span>{% endif %}
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
|
||||
{% if item.distance %}
|
||||
<span class="text-muted">🛤️ {{ "{:,.0f} km".format(item.distance) }}</span>
|
||||
{% endif %}
|
||||
{% if item.co2_kg is defined and item.co2_kg is not none %}
|
||||
<span class="text-muted">CO₂ {{ "{:,.1f}".format(item.co2_kg) }} kg</span>
|
||||
{% endif %}
|
||||
{% if item.coach %}
|
||||
<span class="text-nowrap">🛏️ Coach {{ item.coach }}{% if item.seat %}, Seat {% if item.seat is iterable and item.seat is not string %}{{ item.seat | join(" & ") }}{% else %}{{ item.seat }}{% endif %}{% endif %}</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif e.element_type in ("coach", "bus") %}
|
||||
{% set item = e.detail %}
|
||||
<div class="trip-transport-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
🚌 {{ item.from }} → {{ item.to }}
|
||||
{% if item.operator %}<small class="text-muted fw-normal">{{ item.operator }}</small>{% endif %}
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
{{ item.depart.strftime("%H:%M") }} → {{ item.arrive.strftime("%H:%M") }}
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
|
||||
{% if item.distance %}
|
||||
<span class="text-muted">🛤️ {{ "{:,.0f} km".format(item.distance) }}</span>
|
||||
{% endif %}
|
||||
{% if item.co2_kg is defined and item.co2_kg is not none %}
|
||||
<span class="text-muted">CO₂ {{ "{:,.1f}".format(item.co2_kg) }} kg</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif e.element_type == "ferry" %}
|
||||
{% set item = e.detail %}
|
||||
<div class="trip-transport-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
⛴️ {{ item.from }} → {{ item.to }}
|
||||
<small class="text-muted fw-normal">{{ item.operator }}{% if item.ferry %} · {{ item.ferry }}{% endif %}</small>
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
<div>
|
||||
{{ item.depart.strftime("%H:%M") }} → {{ item.arrive.strftime("%H:%M") }}
|
||||
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
{% if item.co2_kg is defined and item.co2_kg is not none %}
|
||||
<span class="text-muted">CO₂ {{ "{:,.1f}".format(item.co2_kg) }} kg</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if item.vehicle %}
|
||||
<div>🚗 Vehicle: {{ item.vehicle.type }} {% if g.user.is_authenticated %}({{ item.vehicle.registration }}) {% endif %}
|
||||
{% if item.vehicle.extras %} - Extras: {{ item.vehicle.extras | join(", ") }}{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if g.user.is_authenticated %}
|
||||
<div>
|
||||
{% if item.booking_reference %}<strong>Booking reference:</strong> {{ item.booking_reference }}{% endif %}
|
||||
{% if item.price and item.currency %}<span class="badge bg-info text-nowrap">Price: {{ item.price }} {{ item.currency }}</span>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% if trip.flight_bookings %}
|
||||
<h3>Flight bookings</h3>
|
||||
<h3 class="trip-section-h">Flight bookings</h3>
|
||||
{% for item in trip.flight_bookings %}
|
||||
<div>
|
||||
{{ item.flights | map(attribute="airline_name") | unique | join(" + ") }}
|
||||
|
|
@ -257,9 +423,11 @@
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if trip.events %}
|
||||
<h4 class="trip-section-h">Events</h4>
|
||||
{% for item in trip.events %}
|
||||
{% set country = get_country(item.country) if item.country else None %}
|
||||
<div class="card my-1">
|
||||
<div class="trip-event-card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="{{ item.url }}">{{ item.title }}</a>
|
||||
|
|
@ -271,9 +439,7 @@
|
|||
{% if country %}
|
||||
{{ country.flag if trip.show_flags }}
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">
|
||||
country code <strong>{{ item.country }}</strong> not found
|
||||
</span>
|
||||
<span class="text-bg-danger p-2">country code <strong>{{ item.country }}</strong> not found</span>
|
||||
{% endif %}
|
||||
{% if g.user.is_authenticated and item.price and item.currency %}
|
||||
| <span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
|
||||
|
|
@ -282,150 +448,10 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% for item in trip.travel %}
|
||||
<div class="card my-1">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
{% if item.type == "flight" %}
|
||||
✈️
|
||||
{{ item.from_airport.name }} ({{ item.from_airport.iata}})
|
||||
→
|
||||
{{ item.to_airport.name }} ({{item.to_airport.iata}})
|
||||
{% elif item.type == "train" %}
|
||||
🚆
|
||||
{{ item.from }}
|
||||
→
|
||||
{{ item.to }}
|
||||
{% elif item.type == "coach" or item.type == "bus" %}
|
||||
🚌
|
||||
{{ item.from }}
|
||||
→
|
||||
{{ item.to }}
|
||||
{% elif item.type == "ferry" %}
|
||||
⛴️
|
||||
{{ item.from }}
|
||||
→
|
||||
{{ item.to }}
|
||||
{% endif %}
|
||||
</h5>
|
||||
<p class="card-text">
|
||||
{% if item.type == "flight" %}
|
||||
<div>
|
||||
<span>{{ item.airline_name }} ({{ item.airline }})</span>
|
||||
✨
|
||||
{{ display_datetime(item.depart) }}
|
||||
{% if item.arrive %}
|
||||
→
|
||||
{{ item.arrive.strftime("%H:%M %z") }}
|
||||
<span>🕒{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins</span>
|
||||
{% endif %}
|
||||
✨
|
||||
<span>{{ item.airline_code }}{{ item.flight_number }}</span>
|
||||
|
||||
{% if item.distance %}
|
||||
<span>
|
||||
🌍distance:
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
{% elif item.type == "train" %}
|
||||
<div>
|
||||
{{ display_datetime(item.depart) }}
|
||||
→
|
||||
{{ item.arrive.strftime("%H:%M %z") }}
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
<span>🕒{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins</span>
|
||||
{% if item.distance %}
|
||||
<span>
|
||||
🛤️
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif item.type == "coach" or item.type == "bus" %}
|
||||
<div>
|
||||
{{ display_datetime(item.depart) }}
|
||||
→
|
||||
{{ item.arrive.strftime("%H:%M %z") }}
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
<span>🕒{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins</span>
|
||||
{% if item.distance %}
|
||||
<span>
|
||||
🛤️
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif item.type == "ferry" %}
|
||||
<div>
|
||||
<span>{{ item.operator }} - {{ item.ferry }}</span>
|
||||
✨
|
||||
{{ display_datetime(item.depart) }}
|
||||
→
|
||||
{{ item.arrive.strftime("%H:%M %z") }}
|
||||
<span>🕒{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins</span>
|
||||
{% if item.class %}
|
||||
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if item.vehicle %}
|
||||
<div>
|
||||
🚗 Vehicle: {{ item.vehicle.type }} {% if g.user.is_authenticated %}({{ item.vehicle.registration }}) {% endif %}
|
||||
{% if item.vehicle.extras %}
|
||||
- Extras: {{ item.vehicle.extras | join(", ") }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if g.user.is_authenticated %}
|
||||
<div>
|
||||
{% if item.booking_reference %}
|
||||
<strong>Booking reference:</strong> {{ item.booking_reference }}
|
||||
{% endif %}
|
||||
{% if item.price and item.currency %}
|
||||
<span class="badge bg-info text-nowrap">Price: {{ item.price }} {{ item.currency }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if trip_weather %}
|
||||
<div class="mt-3">
|
||||
<h4>Weather forecast</h4>
|
||||
{% set ns = namespace(has_rows=false) %}
|
||||
<table class="table table-hover w-auto">
|
||||
{% for day, elements in trip.elements_grouped_by_day() %}
|
||||
{% set weather = trip_weather.get(day.isoformat()) %}
|
||||
{% if weather %}
|
||||
{% set ns.has_rows = true %}
|
||||
<tr>
|
||||
<td class="text-end text-nowrap">{{ display_date(day) }}</td>
|
||||
<td><img src="https://openweathermap.org/img/wn/{{ weather.icon }}.png" alt="{{ weather.status }}" title="{{ weather.detailed_status }}" width="25" height="25"></td>
|
||||
<td>{{ weather.temp_min }}–{{ weather.temp_max }}°C</td>
|
||||
<td>{{ weather.detailed_status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% if not ns.has_rows %}
|
||||
<p class="text-muted">Forecast not yet available (available up to 8 days ahead).</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-3">
|
||||
<h4>Holidays</h4>
|
||||
<h4 class="trip-section-h">Holidays</h4>
|
||||
{% if holidays %}
|
||||
<table class="table table-hover w-auto">
|
||||
{% for item in holidays %}
|
||||
|
|
@ -447,7 +473,7 @@
|
|||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
<h4>UK school holidays (Bristol)</h4>
|
||||
<h4 class="trip-section-h">UK school holidays (Bristol)</h4>
|
||||
{% if school_holidays %}
|
||||
<table class="table table-hover w-auto">
|
||||
{% for item in school_holidays %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue