add static builder

This commit is contained in:
Thibaud Dauce
2026-02-18 17:23:24 +01:00
parent e60f150611
commit 1561c07432
155 changed files with 161211 additions and 12 deletions

View File

@@ -0,0 +1,46 @@
{% extends "default.html" %}
{% block content %}
<div id="map" class="w-full" style="height: 50rem"></div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-gpx/1.7.0/gpx.min.js"></script>
<script>
var map = L.map('map').setView(new L.LatLng(46.498, 2.197), 7);
var googleSat = L.tileLayer('https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
}).addTo(map);
function loadGPX(trace, color, popup) {
new L.GPX('/traces/' + trace, {
async: true,
marker_options: {
iconSize: [11, 15],
shadowSize: [16.6, 16.6],
iconAnchor: [5.3, 15],
shadowAnchor: [5.3, 15.6],
startIconUrl: '/images/pin-icon-start.png',
endIconUrl: '/images/pin-icon-end.png',
shadowUrl: '/images/pin-shadow.png',
},
polyline_options: {
color: color,
opacity: 1,
weight: 4,
lineCap: 'round'
}
}).on('addpoint', function(e) {
e.target.bindPopup(popup)
}).addTo(map)
}
{% for trip in trips %}
{% for trace in trip.traces %}
loadGPX('{{ trace.path | safe }}', '{{ trip.color }}', "<b>{{ trip.type_as_string }} {{ trip.name }} de {{ trip.date }}</b><br>Distance : {{ trip.distance_format }}<br>Dénivelé: +{{ trip.elevation_positive_format }} | -{{ trip.elevation_negative_format }}<br><br><b>Segment {{ trace.name }}</b><br>Distance : {{ trace.distance_format }}<br>Dénivelé: +{{ trace.elevation_positive_format }} | -{{ trace.elevation_negative_format }}");
{% endfor %}
{% endfor %}
</script>
{% endblock content %}