[openstreetmap/openstreetmap-website] Clean OSM.formatHash calls (PR #5887)

Tom Hughes notifications at github.com
Tue May 6 19:47:42 UTC 2025


@tomhughes commented on this pull request.



> +    return "" unless params[:lat].present? && params[:lon].present?
+
+    "#map=#{params[:zoom] || 17}/#{params[:lat]}/#{params[:lon]}"

I suggest just returning the target:
```suggestion
    return nil unless params[:lat].present? && params[:lon].present?

    [params[:zoom] || 17, params[:lat], params[:lon]].join("/")
```

> @@ -23,6 +19,7 @@
     <h3 class='fs-5'><%= t "site.welcome.add_a_note.title" %></h3>
     <p><%= t "site.welcome.add_a_note.para_1" %></p>
     <p><%= t ".how_to_help.add_a_note.instructions_1_html", :note_icon => tag.a(:class => "icon note bg-dark rounded-1",
+                                                                                :href => "#{new_note_path}#{map_hash(params)}",

then you can do this:
```suggestion
                                                                                :href => new_note_path(:anchor => map_hash(params)),
```

> +  <%= editor_query = "?editor=#{params[:editor]}" if params[:editor].present?
+      link_to t(".start_mapping"), "#{edit_path}#{editor_query || ''}#{map_hash(params)}", :class => "btn btn-primary start-mapping" %>

and this:
```suggestion
  <%= link_to t(".start_mapping"), edit_path(:editor => params[:editor], :anchor => map_hash(params)), :class => "btn btn-primary start-mapping" %>
```

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

Message ID: <openstreetmap/openstreetmap-website/pull/5887/review/2819429769 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250506/1a40773c/attachment.htm>


More information about the rails-dev mailing list