From 80c43f51c2bd97f0bf92026fbb273615e8f9f015 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 16 Aug 2024 18:48:05 +0300 Subject: [PATCH 1/1] Copy "From" endpoint value to search input when closing directions --- app/assets/javascripts/index/directions.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index b34f18ed1..e2cdd3a54 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -75,12 +75,8 @@ OSM.Directions = function (map) { $(".directions_form .btn-close").on("click", function (e) { e.preventDefault(); - var route_from = endpoints[0].value; - if (route_from) { - OSM.router.route("/?query=" + encodeURIComponent(route_from) + OSM.formatHash(map)); - } else { - OSM.router.route("/" + OSM.formatHash(map)); - } + $(".search_form input[name='query']").val(endpoints[0].value); + OSM.router.route("/" + OSM.formatHash(map)); }); function formatDistance(m) { -- 2.39.5