Module: ImagesHelper
- Defined in:
- app/helpers/images_helper.rb
Instance Method Summary collapse
- #image_autocomplete_tag(image) ⇒ Object
- #image_display_url(image) ⇒ Object
-
#image_link(image, size: :thumb) ⇒ Object
!! Rails already provides image_tag, i.e.
-
#images_recent_objects_partial ⇒ True
Indicates a custom partial should be used, see list_helper.rb.
- #images_search_form ⇒ Object
-
#thumb_list_tag(object) ⇒ Object
<div class=“easyzoom easyzoom–overlay”> <a href=“<%= @image.image_file.url(:medium) %>”> <%= image_tag(@image.image_file.url(:medium), 'class' => 'imageZoom') %> </a> </div>.
Instance Method Details
#image_autocomplete_tag(image) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/helpers/images_helper.rb', line 20 def image_autocomplete_tag(image) content_tag(:figure) do ( image_tag(image.image_file.url(:thumb)) + content_tag(:caption, "id:#{image.id}", class: ['feedback', 'feedback-primary', 'feedback-thin']) ).html_safe end end |
#image_display_url(image) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'app/helpers/images_helper.rb', line 45 def image_display_url(image) case image.image_file_content_type when 'image/tiff' "/images/#{image.id}/extract/0/0/#{image.width}/#{image.height}" else root_url + image.image_file.url[1..-1] end end |
#image_link(image, size: :thumb) ⇒ Object
!! Rails already provides image_tag, i.e. it is not required here.
5 6 7 8 |
# File 'app/helpers/images_helper.rb', line 5 def image_link(image, size: :thumb) return nil if image.nil? link_to(image_tag(image.image_file.url(size)), image) end |
#images_recent_objects_partial ⇒ True
Returns indicates a custom partial should be used, see list_helper.rb.
16 17 18 |
# File 'app/helpers/images_helper.rb', line 16 def images_recent_objects_partial true end |
#images_search_form ⇒ Object
10 11 12 |
# File 'app/helpers/images_helper.rb', line 10 def images_search_form render('/images/quick_search_form') end |
#thumb_list_tag(object) ⇒ Object
<div class=“easyzoom easyzoom–overlay”>
<a href="<%= @image.image_file.url(:medium) %>">
<%= image_tag(@image.image_file.url(:medium), 'class' => 'imageZoom') %>
</a>
</div>
35 36 37 38 39 40 41 42 43 |
# File 'app/helpers/images_helper.rb', line 35 def thumb_list_tag(object) if object.depictions.any? object.depictions.collect{|a| content_tag(:div, class: [:easyzoom, 'easyzoom--overlay']) do link_to( depiction_tag(a, size: :medium), a.image.image_file.url()) end }.join.html_safe end end |