🇬🇧 Hide UK flags for all UK trips with show_flags logic 🏴

Implement show_flags property to conditionally display country flags for international trips. Remove unnecessary UK flags on purely UK-based trips. Closes: #183

🔧 Updated templates to use show_flags property.
📝 Adjusted map and trip details to reflect flag changes.
This commit is contained in:
Edward Betts 2024-10-19 19:43:48 +01:00
parent 9ad2ba9462
commit 3c0694de19
4 changed files with 28 additions and 36 deletions

View file

@ -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 @@
</style>
{% 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 %}
<div class="heading"><h2>{{ heading }}</h2></div>
<p><a href="{{ url_for("trip_stats") }}">Trip statistics</a></p>
<p>{{ items | count }} trips</p>
{% if item_list %}
<div>Total distance: {{ format_distance(total_distance) }}</div>
{% 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) %}
<div>
{{ 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) }})
</div>
{% else %}
@ -136,11 +120,11 @@
{{ e.get_emoji() }}
{{ display_time(e.start_time) }}
&ndash;
{{ e.start_loc }} {{ e.start_country.flag }}
{{ e.start_loc }} {{ flag(trip, e.start_country.flag) }}
{{ display_time(e.end_time) }}
&ndash;
{{ 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 %}
<div class="container-fluid d-flex flex-column flex-md-row">
<div class="map-container col-12 col-md-6 order-1 order-md-2">
<button id="toggleMapSize" class="btn btn-primary mb-2">Toggle map size</button>
<div id="map" class="map half-map"></div>
<div id="map" class="map"></div>
</div>
<div class="text-content col-12 col-md-6 order-2 order-md-1 pe-3">
{{ section(heading, trips) }}