This implementation provides automatic geocoding and map integration: - **Event Model Enhancements:** - Automatic geocoding callback using OpenStreetMap Nominatim API - 3-tier fallback system: exact coordinates → city-based → country default - Fallback coordinates for major French cities (Paris, Lyon, Marseille, etc.) - Robust error handling that prevents event creation failures - **User-Friendly Event Forms:** - Address-first approach - users just enter addresses - Hidden coordinate fields (auto-generated behind scenes) - Real-time geocoding with 1.5s debounce - "Ma position" button for current location with reverse geocoding - "Prévisualiser" button to show map links - Smart feedback system (loading, success, warnings, errors) - **Enhanced Event Show Page:** - Map provider links (OpenStreetMap, Google Maps, Apple Plans) - Warning badges when approximate coordinates are used - Address-based URLs for better map integration - **Comprehensive JavaScript Controller:** - Debounced auto-geocoding to minimize API calls - Multiple geocoding strategies (manual vs automatic) - Promise-based geolocation with proper error handling - Dynamic map link generation with address + coordinates - **Failure Handling:** - Events never fail to save due to missing coordinates - Fallback to city-based coordinates when exact geocoding fails - User-friendly warnings when approximate locations are used - Maintains existing coordinates on update failures 🤖 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
27 lines
1.0 KiB
JavaScript
Executable File
27 lines
1.0 KiB
JavaScript
Executable File
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
|
// Run that command whenever you add a new controller or create them with
|
|
// ./bin/rails generate stimulus controllerName
|
|
|
|
import { application } from "./application";
|
|
|
|
import LogoutController from "./logout_controller";
|
|
application.register("logout", LogoutController);
|
|
|
|
import CounterController from "./counter_controller";
|
|
application.register("counter", CounterController);
|
|
|
|
import FlashMessageController from "./flash_message_controller";
|
|
application.register("flash-message", FlashMessageController);
|
|
|
|
import TicketSelectionController from "./ticket_selection_controller";
|
|
application.register("ticket-selection", TicketSelectionController);
|
|
|
|
import HeaderController from "./header_controller";
|
|
application.register("header", HeaderController);
|
|
|
|
import QrCodeController from "./qr_code_controller";
|
|
application.register("qr-code", QrCodeController);
|
|
|
|
import EventFormController from "./event_form_controller";
|
|
application.register("event-form", EventFormController);
|