[openstreetmap/openstreetmap-website] Add viewbox param to Nominatim link in search results (PR #5863)

Tom Hughes notifications at github.com
Mon Mar 31 09:47:45 UTC 2025


@tomhughes commented on this pull request.



> @@ -9,14 +9,17 @@ class GeocoderController < ApplicationController
   authorize_resource :class => false
 
   def search
-    @params = normalize_params
+    normalize_params

This could be a `before_action` now if we don't need to use the result?

> @@ -18,9 +21,14 @@ OSM.Search = function (map) {
   $(".search_form").on("submit", function (e) {
     e.preventDefault();
     $("header").addClass("closed");
-    const query = $(this).find("input[name=query]").val();
-    let search = "/";
-    if (query) search = "/search?" + new URLSearchParams({ query });
+    const params = new URLSearchParams;
+    for (const paramName of ["query", "zoom", "minlon", "minlat", "maxlon", "maxlat"]) {

If we're going to build the URL in the submit handler why not just add the parameters from the bounding box here instead of adding hidden input fields and an event handler to keep them up to date?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5863#pullrequestreview-2728756323
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5863/review/2728756323 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250331/79122353/attachment.htm>


More information about the rails-dev mailing list