From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:36:27 +0000 (+0100) Subject: Associate search input with route destination instead of departure X-Git-Tag: live~6^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e6b0e1ae7ef45b87a61f18bb50296273d6dd1bfb Associate search input with route destination instead of departure --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 2338f537f..3d6da84fc 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -73,8 +73,8 @@ OSM.Directions = function (map) { $(".directions_form .btn-close").on("click", function (e) { e.preventDefault(); - $(".describe_location").toggle(!endpoints[0].value); - $(".search_form input[name='query']").val(endpoints[0].value); + $(".describe_location").toggle(!endpoints[1].value); + $(".search_form input[name='query']").val(endpoints[1].value); OSM.router.route("/" + OSM.formatHash(map)); }); diff --git a/app/assets/javascripts/index/search.js b/app/assets/javascripts/index/search.js index 42294576b..b33d904a9 100644 --- a/app/assets/javascripts/index/search.js +++ b/app/assets/javascripts/index/search.js @@ -11,7 +11,7 @@ OSM.Search = function (map) { e.preventDefault(); const query = $(this).closest("form").find("input[name=query]").val(); let search = ""; - if (query) search = "?" + new URLSearchParams({ from: query }); + if (query) search = "?" + new URLSearchParams({ to: query }); OSM.router.route("/directions" + search + OSM.formatHash(map)); });