Fix: Standort-Fehlermeldung schliessbar, manuelle Standorteingabe
Behebt Gitea Issue #1 "Eigenen Standort verwenden" (zwei Teilprobleme): 1. Die Fehlermeldung bei fehlgeschlagener Geolocation-Abfrage (#app-status) liess sich bisher nicht schliessen und blockierte dauerhaft die UI. Neuer Schliessen-Button (#app-status-close), unabhaengig vom restlichen Bootstrap-Ablauf verdrahtet, damit er auch bei einem fruehen Init-Fehler funktioniert. 2. Es gab keine Moeglichkeit, den Standort manuell zu setzen, wenn die Browser-Geolocation fehlschlaegt oder nicht verfuegbar ist. Neues Modal (js/ui/manualLocation.js) mit Breiten-/Laengengrad-Eingabe, Validierung (aria-invalid/Inline-Fehler analog zum Ausflugsziel-Formular), setzt bei gueltiger Eingabe state.userLocation direkt - Karte, Liste und Entfernungsfilter reagieren automatisch darauf.
This commit is contained in:
+43
-3
@@ -3,15 +3,42 @@
|
||||
(function () {
|
||||
const { initStore } = EventMap.store;
|
||||
const { initMap, centerOnCoords, requestUserLocation } = EventMap.map;
|
||||
const { initList, initDetail, initForm, initFilterPanel, initPromptGenerator } = EventMap.ui;
|
||||
const {
|
||||
initList,
|
||||
initDetail,
|
||||
initForm,
|
||||
initManualLocationForm,
|
||||
initFilterPanel,
|
||||
initPromptGenerator,
|
||||
} = EventMap.ui;
|
||||
|
||||
function showFatalError(message) {
|
||||
const status = document.getElementById('app-status');
|
||||
if (!status) return;
|
||||
status.textContent = message;
|
||||
const statusText = document.getElementById('app-status-text');
|
||||
if (!status || !statusText) return;
|
||||
statusText.textContent = message;
|
||||
status.hidden = false;
|
||||
}
|
||||
|
||||
function hideStatus() {
|
||||
const status = document.getElementById('app-status');
|
||||
const statusText = document.getElementById('app-status-text');
|
||||
if (!status || !statusText) return;
|
||||
status.hidden = true;
|
||||
statusText.textContent = '';
|
||||
}
|
||||
|
||||
// Verdrahtet den Schließen-Button der Statusmeldung unabhängig vom
|
||||
// restlichen Bootstrap-Ablauf, damit er auch dann funktioniert, wenn
|
||||
// bootstrap() selbst fehlschlägt und showFatalError() aus dem
|
||||
// catch-Handler heraus aufgerufen wird (siehe Gitea Issue #1: die
|
||||
// Fehlermeldung war bisher dauerhaft nicht schließbar).
|
||||
function setupStatusClose() {
|
||||
const closeBtn = document.getElementById('app-status-close');
|
||||
if (!closeBtn) return;
|
||||
closeBtn.addEventListener('click', hideStatus);
|
||||
}
|
||||
|
||||
function setupGeolocationButton() {
|
||||
const button = document.getElementById('locate-btn');
|
||||
if (!button) return;
|
||||
@@ -39,6 +66,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
function setupManualLocationButton() {
|
||||
const button = document.getElementById('manual-location-btn');
|
||||
if (!button) return;
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
EventMap.ui.openManualLocationForm();
|
||||
});
|
||||
}
|
||||
|
||||
function setupAddPlaceButton() {
|
||||
const button = document.getElementById('add-place-btn');
|
||||
if (!button) return;
|
||||
@@ -64,12 +100,16 @@
|
||||
initList('place-list');
|
||||
initDetail('detail-modal');
|
||||
initForm('place-form-modal');
|
||||
initManualLocationForm('manual-location-modal');
|
||||
initPromptGenerator('prompt-generator-modal');
|
||||
setupGeolocationButton();
|
||||
setupManualLocationButton();
|
||||
setupAddPlaceButton();
|
||||
setupPromptGeneratorButton();
|
||||
}
|
||||
|
||||
setupStatusClose();
|
||||
|
||||
bootstrap().catch((err) => {
|
||||
console.error('EventMap: Initialisierung fehlgeschlagen.', err);
|
||||
showFatalError('Die Anwendung konnte nicht geladen werden. Bitte Seite neu laden.');
|
||||
|
||||
Reference in New Issue
Block a user