From b4952ff7f20e296b00af8ec57382e5fd6d45ab09 Mon Sep 17 00:00:00 2001 From: mmd-osm Date: Wed, 31 Jul 2024 21:31:17 +0200 Subject: [PATCH] Trace picture with fixed size --- app/helpers/trace_helper.rb | 8 ++++++++ app/views/traces/edit.html.erb | 2 +- app/views/traces/show.html.erb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/helpers/trace_helper.rb b/app/helpers/trace_helper.rb index db1f8357e..fbbeb3dff 100644 --- a/app/helpers/trace_helper.rb +++ b/app/helpers/trace_helper.rb @@ -10,4 +10,12 @@ module TraceHelper image_tag trace_icon_path(trace.user, trace), options.merge(:size => 50) end + + def trace_picture(trace, options = {}) + options[:class] ||= "trace_image" + options[:alt] ||= "" + + image_tag trace_picture_path(trace.user, trace), + options.merge(:size => 250) + end end diff --git a/app/views/traces/edit.html.erb b/app/views/traces/edit.html.erb index 2059178cf..1c440adf2 100644 --- a/app/views/traces/edit.html.erb +++ b/app/views/traces/edit.html.erb @@ -2,7 +2,7 @@

<%= t ".heading", :name => @trace.name %>

<% end %> -<%= image_tag trace_picture_path(@trace.user, @trace), :class => "trace_image" %> +<%= trace_picture(@trace) %> <%= bootstrap_form_for @trace do |f| %> <%= f.text_field :name, :disabled => true %> diff --git a/app/views/traces/show.html.erb b/app/views/traces/show.html.erb index 51b21f982..63adf1572 100644 --- a/app/views/traces/show.html.erb +++ b/app/views/traces/show.html.erb @@ -4,7 +4,7 @@ <% if Settings.status != "gpx_offline" %> <% if @trace.inserted %> - <%= image_tag trace_picture_path(@trace.user, @trace), :class => "trace_image" %> + <%= trace_picture(@trace) %> <% else %> <%= t ".pending" %> <% end %> -- 2.39.5