Hide map on trip page when there are no coordinates or routes

Closes #205

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-04-23 13:19:13 +01:00
parent 76360c25f3
commit 3ba18f9019
2 changed files with 16 additions and 4 deletions

View file

@ -27,7 +27,7 @@
{% block style %}
{% if coordinates %}
{% if coordinates or routes %}
<link rel="stylesheet" href="{{ url_for("static", filename="leaflet/leaflet.css") }}">
{% endif %}
<link rel="stylesheet" href="{{ url_for("static", filename="css/trips.css") }}">
@ -101,7 +101,7 @@
{% block content %}
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="{% if coordinates or routes %}col-md-6{% else %}col-md-12{% endif %} col-sm-12">
<div class="m-3">
<div class="trip-prev-next">{{ next_and_previous() }}</div>
<h1 class="trip-page-title">{{ trip.title }}</h1>
@ -497,16 +497,18 @@
</div>
</div>
{% if coordinates or routes %}
<div class="col-md-6 col-sm-12">
<button id="toggleMapSize" class="btn btn-primary mb-2">Toggle map size</button>
<div id="map" class="half-map">
</div>
</div>
{% endif %}
</div>
{% endblock %}
{% block scripts %}
{% if coordinates or routes %}
<script src="{{ url_for("static", filename="leaflet/leaflet.js") }}"></script>
<script src="{{ url_for("static", filename="leaflet-geodesic/leaflet.geodesic.umd.min.js") }}"></script>
@ -519,4 +521,5 @@ var routes = {{ routes | tojson }};
build_map("map", coordinates, routes);
</script>
{% endif %}
{% endblock %}