Add map fixture.

This commit is contained in:
Edward Betts 2025-11-13 06:42:12 +00:00
parent 178c669b01
commit 6d899113ce
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Map fixture</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📅</text></svg>">
<link href="{{ url_for("static", filename="bootstrap5/css/bootstrap.min.css") }}" rel="stylesheet">
<link rel="stylesheet" href="{{ url_for("static", filename="leaflet/leaflet.css") }}">
<style>
body, html {
height: 100%;
margin: 0;
}
#map {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<script src="{{ url_for("static", filename="leaflet/leaflet.js") }}"></script>
<script src="{{ url_for("static", filename="leaflet-geodesic/leaflet.geodesic.umd.min.js") }}"></script>
<script src="{{ url_for("static", filename="js/map.js") }}"></script>
<script>
var coordinates = {{ coordinates | tojson }};
var routes = {{ routes | tojson }};
build_map("map", coordinates, routes);
</script>
<script src="{{ url_for("static", filename="bootstrap5/js/bootstrap.bundle.min.js") }}"></script>
</body>
</html>

View file

@ -477,6 +477,22 @@ def trip_past_list() -> str:
) )
@app.route("/fixture/map")
def fixture_trip_map() -> str:
"""Map of trips."""
trips = get_trip_list()
coordinates, routes = agenda.trip.get_coordinates_and_routes(trips)
return flask.render_template(
"fixture/map.html",
heading="Trip map",
trips=trips,
coordinates=coordinates,
routes=routes,
get_country=agenda.get_country,
)
@app.route("/trip/future") @app.route("/trip/future")
def trip_future_list() -> str: def trip_future_list() -> str:
"""Page showing a list of future trips.""" """Page showing a list of future trips."""