Toggle map-show
Deploy PBT / deploy (push) Successful in 16s

This commit is contained in:
2026-09-11 16:04:53 +02:00
parent c9f298223b
commit 039e2905dd
6 changed files with 84 additions and 35 deletions
+17 -11
View File
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% block title %}{{ "Fahrt bearbeiten" if fahrt else "Neue Fahrt" }} PBT{% endblock %}
{% block head %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
{% if show_map %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
{% endif %}
{% endblock %}
{% block content %}
<div class="card">
@@ -54,12 +56,14 @@
if fahrt and fahrt.destination_stop else "" }}</p>
</div>
<div class="field">
<label>Kartenvorschau</label>
<p class="field-hint" data-route-map-placeholder>Wähle bekannte Haltestellen bei Von/Nach für eine Kartenvorschau.</p>
<div id="route-map" class="route-map" hidden></div>
<p class="field-hint">Luftlinie zwischen den Halten keine echte Streckenführung.</p>
</div>
{% if show_map %}
<div class="field">
<label>Kartenvorschau</label>
<p class="field-hint" data-route-map-placeholder>Wähle bekannte Haltestellen bei Von/Nach für eine Kartenvorschau.</p>
<div id="route-map" class="route-map" hidden></div>
<p class="field-hint">Luftlinie zwischen den Halten keine echte Streckenführung.</p>
</div>
{% endif %}
<div class="field combo">
<label for="line">Linie</label>
@@ -115,8 +119,10 @@
</div>
{% endblock %}
{% block scripts %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" defer></script>
<script src="{{ url_for('static', filename='map.js') }}" defer></script>
{% if show_map %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" defer></script>
<script src="{{ url_for('static', filename='map.js') }}" defer></script>
{% endif %}
<script src="{{ url_for('static', filename='stops.js') }}" defer></script>
{% endblock %}
+32 -24
View File
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% block title %}Meine Fahrten PBT{% endblock %}
{% block head %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
{% if show_map %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
{% endif %}
{% endblock %}
{% block content %}
<h2 style="font-size: 1.1rem; font-weight: 600;">Meine Fahrten</h2>
@@ -40,18 +42,20 @@
<td class="stars">{{ "★" * f.rating }}{{ "☆" * (5 - f.rating) }}</td>
<td>
<div class="row-actions">
<button type="button" class="icon-btn map" title="Route auf Karte anzeigen"
aria-label="Route auf Karte anzeigen" data-show-map
data-origin-label="{{ f.origin }}" data-destination-label="{{ f.destination }}"
{% if f.origin_stop %}data-origin-lat="{{ f.origin_stop.latitude }}" data-origin-lon="{{ f.origin_stop.longitude }}"{% endif %}
{% if f.destination_stop %}data-destination-lat="{{ f.destination_stop.latitude }}" data-destination-lon="{{ f.destination_stop.longitude }}"{% endif %}
{% if not f.origin_stop and not f.destination_stop %}disabled{% endif %}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
</button>
{% if show_map %}
<button type="button" class="icon-btn map" title="Route auf Karte anzeigen"
aria-label="Route auf Karte anzeigen" data-show-map
data-origin-label="{{ f.origin }}" data-destination-label="{{ f.destination }}"
{% if f.origin_stop %}data-origin-lat="{{ f.origin_stop.latitude }}" data-origin-lon="{{ f.origin_stop.longitude }}"{% endif %}
{% if f.destination_stop %}data-destination-lat="{{ f.destination_stop.latitude }}" data-destination-lon="{{ f.destination_stop.longitude }}"{% endif %}
{% if not f.origin_stop and not f.destination_stop %}disabled{% endif %}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
</button>
{% endif %}
<a class="icon-btn edit" href="{{ url_for('fahrt_bearbeiten', fahrt_id=f.id) }}"
title="Fahrt bearbeiten" aria-label="Fahrt bearbeiten">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
@@ -83,16 +87,20 @@
</table>
{% endif %}
<dialog id="route-map-dialog" class="map-dialog">
<div class="map-dialog-header">
<span id="route-map-dialog-title"></span>
<button type="button" class="icon-btn" data-close-map-dialog aria-label="Schließen"></button>
</div>
<div id="dialog-route-map" class="route-map"></div>
</dialog>
{% if show_map %}
<dialog id="route-map-dialog" class="map-dialog">
<div class="map-dialog-header">
<span id="route-map-dialog-title"></span>
<button type="button" class="icon-btn" data-close-map-dialog aria-label="Schließen"></button>
</div>
<div id="dialog-route-map" class="route-map"></div>
</dialog>
{% endif %}
{% endblock %}
{% block scripts %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" defer></script>
<script src="{{ url_for('static', filename='map.js') }}" defer></script>
{% if show_map %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="" defer></script>
<script src="{{ url_for('static', filename='map.js') }}" defer></script>
{% endif %}
{% endblock %}