]> git.openstreetmap.org Git - rails.git/blob - app/helpers/trace_helper.rb
Merge remote-tracking branch 'upstream/pull/6980'
[rails.git] / app / helpers / trace_helper.rb
1 # frozen_string_literal: true
2
3 module TraceHelper
4   def trace_image(trace, animated: false, only_path: true, **options)
5     args = [trace.user, trace, { :only_path => only_path }]
6     src = animated ? trace_picture_url(*args) : trace_icon_url(*args)
7     image_tag(src, { :class => "trace_image", :alt => "" }.merge(options))
8   end
9
10   def link_to_tag(tag)
11     link_to(tag, :tag => tag, :page => nil)
12   end
13
14   def trace_icon(trace, options = {})
15     trace_image(trace, :size => 50, **options)
16   end
17
18   def trace_picture(trace, options = {})
19     trace_image(trace, :animated => true, :size => 250, **options)
20   end
21 end