]> git.openstreetmap.org Git - rails.git/commitdiff
Trace image with fixed size
authormmd-osm <mmd.osm@gmail.com>
Mon, 29 Jul 2024 18:39:00 +0000 (20:39 +0200)
committermmd-osm <mmd.osm@gmail.com>
Tue, 30 Jul 2024 16:05:25 +0000 (18:05 +0200)
app/helpers/trace_helper.rb
app/views/traces/_trace.html.erb

index aec1146cb8da9c68fd100364be0b7a626a98ecd5..db1f8357ea39c30339491c1ca1cb04ca7466fbf0 100644 (file)
@@ -2,4 +2,12 @@ module TraceHelper
   def link_to_tag(tag)
     link_to(tag, :tag => tag, :page => nil)
   end
   def link_to_tag(tag)
     link_to(tag, :tag => tag, :page => nil)
   end
+
+  def trace_icon(trace, options = {})
+    options[:class] ||= "trace_image"
+    options[:alt] ||= ""
+
+    image_tag trace_icon_path(trace.user, trace),
+              options.merge(:size => 50)
+  end
 end
 end
index ba503f7306d335b8eb43d580bd4c33488710d864..f60eea7f1cbe22834e631359484b592f6cddb0a7 100644 (file)
@@ -2,7 +2,7 @@
   <td>
     <% if Settings.status != "gpx_offline" %>
       <% if trace.inserted %>
   <td>
     <% if Settings.status != "gpx_offline" %>
       <% if trace.inserted %>
-        <%= link_to image_tag(trace_icon_path(trace.user, trace), :alt => "", :class => "trace_image"),
+        <%= link_to trace_icon(trace),
                     show_trace_path(trace.user, trace),
                     :class => "d-inline-block" %>
       <% else %>
                     show_trace_path(trace.user, trace),
                     :class => "d-inline-block" %>
       <% else %>