Show linked events on trip page

Closes: #124
This commit is contained in:
Edward Betts 2024-01-24 12:03:56 +00:00
parent 14c25e16ed
commit 89ff92c533
3 changed files with 32 additions and 3 deletions

View file

@ -106,7 +106,11 @@ def collect_trip_coordinates(trip: Trip) -> list[StrDict]:
coords = [] coords = []
src = [("accommodation", trip.accommodation), ("conference", trip.conferences)] src = [
("accommodation", trip.accommodation),
("conference", trip.conferences),
("event", trip.events),
]
for coord_type, item_list in src: for coord_type, item_list in src:
coords += [ coords += [
{ {

View file

@ -18,6 +18,7 @@ var icons = {
"airport": emoji_icon("✈️"), "airport": emoji_icon("✈️"),
"accommodation": emoji_icon("🏨"), "accommodation": emoji_icon("🏨"),
"conference": emoji_icon("🎤"), "conference": emoji_icon("🎤"),
"event": emoji_icon("🍷"),
} }
function build_map(map_id, coordinates, routes) { function build_map(map_id, coordinates, routes) {

View file

@ -137,8 +137,32 @@
| Location: {{ item.location }} | Location: {{ item.location }}
{% if country %} {% if country %}
{{ country.flag }} {{ country.flag }}
{% elif item.online %} {% else %}
💻 Online <span class="text-bg-danger p-2">
country code <strong>{{ item.country }}</strong> not found
</span>
{% endif %}
{% if item.price and item.currency %}
| <span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
{% endif %}
</p>
</div>
</div>
{% endfor %}
{% for item in trip.events %}
{% 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.title }}</a>
<small class="text-muted">{{ display_date_no_year(item.date) }}</small>
</h5>
<p class="card-text">
Address: {{ item.address }}
| Location: {{ item.location }}
{% if country %}
{{ country.flag }}
{% else %} {% else %}
<span class="text-bg-danger p-2"> <span class="text-bg-danger p-2">
country code <strong>{{ item.country }}</strong> not found country code <strong>{{ item.country }}</strong> not found