From 8e674316225503d6fcccaac5af0a62801ec78514 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 6 Feb 2026 08:47:28 +0100 Subject: [PATCH] fix: use title-based slugs for new markers Generate marker slugs from title (e.g., "marqueur-2") instead of timestamp-based slugs (e.g., "marker-1770362950"). Also fix panelUrl generation to use Kirby's panel URL method. Co-Authored-By: Claude Sonnet 4.5 --- public/site/plugins/map-editor/api/routes.php | 6 +- .../src/components/field/MapEditor.vue | 101 +++++++++++++----- 2 files changed, 79 insertions(+), 28 deletions(-) diff --git a/public/site/plugins/map-editor/api/routes.php b/public/site/plugins/map-editor/api/routes.php index 035bb53..d5045fa 100644 --- a/public/site/plugins/map-editor/api/routes.php +++ b/public/site/plugins/map-editor/api/routes.php @@ -166,9 +166,9 @@ return [ ->filterBy('intendedTemplate', 'marker'); $nextNum = $existingMarkers->count() + 1; - // Generate unique slug and title - $slug = 'marker-' . time(); + // Generate title and slug based on title $title = 'Marqueur ' . $nextNum; + $slug = Str::slug($title); // Create the new marker page $newMarker = $mapPage->createChild([ @@ -307,7 +307,7 @@ return [ 'lon' => $lon ], 'num' => $marker->num(), - 'panelUrl' => '/panel/pages/' . $marker->id(), + 'panelUrl' => (string) $marker->panel()->url(), 'iconUrl' => $iconUrl, 'iconSize' => $iconSize ] diff --git a/public/site/plugins/map-editor/src/components/field/MapEditor.vue b/public/site/plugins/map-editor/src/components/field/MapEditor.vue index c96bb21..d8a969b 100644 --- a/public/site/plugins/map-editor/src/components/field/MapEditor.vue +++ b/public/site/plugins/map-editor/src/components/field/MapEditor.vue @@ -36,7 +36,14 @@