diff --git a/agenda/types.py b/agenda/types.py
index bbb8e00..c7bcb45 100644
--- a/agenda/types.py
+++ b/agenda/types.py
@@ -2,6 +2,7 @@
import collections
import datetime
+import functools
import typing
from collections import defaultdict
from dataclasses import dataclass, field
@@ -167,6 +168,11 @@ class Trip:
# Don't include GB in countries visited unless entire trip was GB based
return [c for c in items if c.alpha_2 != "GB"] or items
+ @functools.cached_property
+ def show_flags(self) -> bool:
+ """Show flags for international trips."""
+ return len(self.countries) != 1 or self.countries[0].name != "United Kingdom"
+
@property
def countries_str(self) -> str:
"""List of countries visited on this trip."""
@@ -178,7 +184,10 @@ class Trip:
def locations_str(self) -> str:
"""List of countries visited on this trip."""
return format_list_with_ampersand(
- [f"{location} ({c.name}) {c.flag}" for location, c in self.locations()]
+ [
+ f"{location} ({c.name})" + (f" {c.flag}" if self.show_flags else "")
+ for location, c in self.locations()
+ ]
)
@property
diff --git a/templates/macros.html b/templates/macros.html
index a60c614..9e7785c 100644
--- a/templates/macros.html
+++ b/templates/macros.html
@@ -13,7 +13,7 @@
{{ trip.title }}
{% endmacro %}
-{% macro conference_row(item, badge) %}
+{% macro conference_row(item, badge, show_flags=True) %}
{% set country = get_country(item.country) if item.country else None %}
{{ item.start.strftime("%a, %d %b %Y") }}
{{ item.end.strftime("%a, %d %b") }}
@@ -50,7 +50,7 @@
{{ display_date(item.cfp_end) if item.cfp_end else "" }}
{% if country %}
- {{ country.flag }} {{ country.name }}
+ {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }}
{% elif item.online %}
💻 Online
{% else %}
@@ -61,7 +61,7 @@
{% endmacro %}
-{% macro accommodation_row(item, badge) %}
+{% macro accommodation_row(item, badge, show_flags=True) %}
{% set country = get_country(item.country) %}
{% set nights = (item.to.date() - item.from.date()).days %}
@@ -72,7 +72,7 @@
{{ item.location }}
{% if country %}
- {{ country.flag }} {{ country.name }}
+ {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }}
{% else %}
country code {{ item.country }} not found
@@ -96,7 +96,7 @@
{% endmacro %}
-{% macro flight_booking_row(booking) %}
+{% macro flight_booking_row(booking, show_flags=True) %}
{% if g.user.is_authenticated %}
{{ booking.booking_reference or "reference missing" }}
diff --git a/templates/trip/list.html b/templates/trip/list.html
index f25e8ae..5faa3d8 100644
--- a/templates/trip/list.html
+++ b/templates/trip/list.html
@@ -25,25 +25,8 @@
top: 56px; /* Adjust to be below the navbar */
height: calc(100vh - 56px); /* Subtracting the height of the navbar */
}
-
- .half-map {
- height: 100vh;
- }
-
- .full-window-map {
- position: fixed; /* Make the map fixed position */
- top: 60px;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 9999; /* Make sure it sits on top */
- }
-
- #toggleMapSize {
- position: fixed; /* Fixed position */
- top: 70px; /* 10px from the top */
- right: 10px; /* 10px from the right */
- z-index: 10000; /* Higher than the map's z-index */
+ #map {
+ height: 100%;
}
@media (max-width: 767.98px) {
@@ -64,13 +47,14 @@
{% endblock %}
+{% macro flag(trip, flag) %}{% if trip.show_flags %}{{ flag }}{% endif %}{% endmacro %}
+
{% macro section(heading, item_list) %}
+ {% if item_list %}
{% set items = item_list | list %}
{{ heading }}
-
Trip statistics
{{ items | count }} trips
- {% if item_list %}
Total distance: {{ format_distance(total_distance) }}
{% for transport_type, distance in distances_by_transport_type %}
@@ -128,7 +112,7 @@
{% if e.element_type in accommodation_label %}
{% set c = get_country(e.detail.country) %}
- {{ e.get_emoji() }} {{ e.title }} {{ c.flag }}
+ {{ e.get_emoji() }} {{ e.title }} {{ flag(trip, c.flag) }}
({{ accommodation_label[e.element_type] }} {{ display_time(e.start_time) }})
{% else %}
@@ -136,11 +120,11 @@
{{ e.get_emoji() }}
{{ display_time(e.start_time) }}
–
- {{ e.start_loc }} {{ e.start_country.flag }}
+ {{ e.start_loc }} {{ flag(trip, e.start_country.flag) }}
→
{{ display_time(e.end_time) }}
–
- {{ e.end_loc }} {{ e.end_country.flag }}
+ {{ e.end_loc }} {{ flag(trip, e.end_country.flag) }}
{% if e.element_type == "flight" %}
{% set full_flight_number = e.detail.airline + e.detail.flight_number %}
{% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
@@ -210,8 +194,7 @@
{% block content %}
{{ section(heading, trips) }}
diff --git a/templates/trip_page.html b/templates/trip_page.html
index df563bb..bf961fa 100644
--- a/templates/trip_page.html
+++ b/templates/trip_page.html
@@ -134,7 +134,7 @@
Venue: {{ item.venue }}
Location: {{ item.location }}
{% if country %}
- {{ country.flag }}
+ {{ country.flag if trip.show_flags }}
{% elif item.online %}
💻 Online
{% else %}
@@ -169,7 +169,7 @@
Address: {{ item.address }}
Location: {{ item.location }}
{% if country %}
- {{ country.flag }}
+ {{ country.flag if trip.show_flags }}
{% else %}
country code {{ item.country }} not found
@@ -210,7 +210,7 @@
Address: {{ item.address }}
| Location: {{ item.location }}
{% if country %}
- {{ country.flag }}
+ {{ country.flag if trip.show_flags }}
{% else %}
country code {{ item.country }} not found
@@ -297,7 +297,7 @@
{% else %}
|
{% endif %}
- {{ country.flag }} {{ country.name }} |
+ {{ country.flag if trip.show_flags }} {{ country.name }} |
{{ item.display_name }} |
{% endfor %}