[openstreetmap/openstreetmap-website] Define fixed size for trace images (PR #5030)

mmd notifications at github.com
Tue Jul 30 06:14:38 UTC 2024


@mmd-osm commented on this pull request.



> +  def trace_image(trace, options = {})
+    options[:class] ||= "trace_image"
+    options[:alt] ||= ""
+
+    link_to(image_tag(trace_icon_path(trace.user, trace),
+                      options.merge(:width => 50, :height => 50)),
+            show_trace_path(trace.user, trace),
+            :class => "d-inline-block")
+  end

I renamed trace_image to trace_preview_image. Not sure if there's a better name for "preview". Then I moved everything which doesn't belong there back to _trace.html.erb. 

The reusable is following the pattern in user_helper.rb. I started adding options[:class], options[:alt], etc in _trace.html.erb, but this looked a bit ugly and cluttered the html code. That's why I moved it to a helper.

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

Message ID: <openstreetmap/openstreetmap-website/pull/5030/review/2206732275 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240729/8d1269b8/attachment-0001.htm>


More information about the rails-dev mailing list