]> git.openstreetmap.org Git - rails.git/commitdiff
Copy "From" endpoint value to search input when closing directions
authorAnton Khorev <tony29@yandex.ru>
Fri, 16 Aug 2024 15:48:05 +0000 (18:48 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 16 Aug 2024 15:48:05 +0000 (18:48 +0300)
app/assets/javascripts/index/directions.js

index b34f18ed1e52fd24b3f89c6de75957adb7745991..e2cdd3a548b80e52f33048b6ed3979ea9ce8493a 100644 (file)
@@ -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) {