Module: SqedDepictionsHelper

Defined in:
app/helpers/sqed_depictions_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) sqed_depiction_collecting_event_label_thumb_preview(sqed_depiction)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/sqed_depictions_helper.rb', line 13

def sqed_depiction_collecting_event_label_thumb_preview(sqed_depiction)
  return (:div, 'no depiction provided', class: :warning) if sqed_depiction.nil?
  section = sqed_depiction.collecting_event_sections.first
  return (:div, 'no collecting event label data imaged', class: :warning) if section.nil?

  begin
    result = SqedToTaxonworks::Result.new(
      depiction_id: sqed_depiction.depiction.id,
    )

   return image_tag(result.image_path_for_large_image(section), id: "little1", class: "little_image clickable") 
  rescue
   return (:div, link_to('Error parsing.', depiction_path(sqed_depiction.depiction)), class: :warning) 
  end
end


8
9
10
11
# File 'app/helpers/sqed_depictions_helper.rb', line 8

def sqed_depiction_link(sqed_depiction)
  return nil if sqed_depiction.nil?
  link_to(sqed_depiction_tag(sqed_depiction), sqed_depiction.depiction)
end

- (Object) sqed_depiction_tag(sqed_depiction)



3
4
5
6
# File 'app/helpers/sqed_depictions_helper.rb', line 3

def sqed_depiction_tag(sqed_depiction)
  return nil if sqed_depiction.nil?
  image_tag(sqed_depiction.depiction.image.image_file.url(:thumb)) + " on " + object_tag(sqed_depiction.depiction.depiction_object.metamorphosize)
end

- (Object) sqed_depiction_thumb_navigator(sqed_depiction, before = 3, after = 3)



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/sqed_depictions_helper.rb', line 29

def sqed_depiction_thumb_navigator(sqed_depiction, before = 3, after = 3)
  around = sqed_depiction.nearby_sqed_depictions(before, after)
  
  around[:before].reverse.collect{|s| 
    link_to(sqed_depiction_collecting_event_label_thumb_preview(s), collection_object_buffered_data_breakdown_task_path(s.depiction.depiction_object))  
  }.join().html_safe +
  
  (:div, " this record ", class: 'sqed_thumb_nav_current') +
 
  around[:after].collect{|s| 
    link_to(sqed_depiction_collecting_event_label_thumb_preview(s), collection_object_buffered_data_breakdown_task_path(s.depiction.depiction_object), 'data-no-turbolink' => 'true')  
  }.join().html_safe 
end