Module: CollectingEventsHelper

Defined in:
app/helpers/collecting_events_helper.rb

Instance Method Summary (collapse)

Instance Method Details



9
10
11
12
# File 'app/helpers/collecting_events_helper.rb', line 9

def collecting_event_link(collecting_event)
  return nil if collecting_event.nil?
  link_to(collecting_event_tag(collecting_event).html_safe, collecting_event)
end

- (String) collecting_event_namespace_select_tag

Returns short string of use in autocomplete selects

Returns:

  • (String)

    short string of use in autocomplete selects



28
29
30
# File 'app/helpers/collecting_events_helper.rb', line 28

def collecting_event_namespace_select_tag
  select_tag(:ce_namespace, options_for_select(Namespace.pluck(:short_name).uniq), prompt: 'Select a namespace')
end

- (Object) collecting_event_tag(collecting_event)



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

def collecting_event_tag(collecting_event)
  return nil if collecting_event.nil?
  string = [collecting_event.cached, collecting_event.verbatim_label, collecting_event.print_label, collecting_event.document_label, collecting_event.field_notes, collecting_event.to_param].compact.first
  string
end

- (Object) collecting_events_search_form



14
15
16
# File 'app/helpers/collecting_events_helper.rb', line 14

def collecting_events_search_form
  render('/collecting_events/quick_search_form')
end

- (String?) date_range_tag(collecting_event)

Returns summary of date data

Returns:

  • (String, nil)

    summary of date data



44
45
46
47
# File 'app/helpers/collecting_events_helper.rb', line 44

def date_range_tag(collecting_event)
  return if collecting_event.nil?
  [collecting_event.start_date_string, collecting_event.end_date_string].compact.join("-")
end

- (String?) elevation_tag(collecting_event)

Returns summary of elevation data

Returns:

  • (String, nil)

    summary of elevation data



34
35
36
37
38
39
40
# File 'app/helpers/collecting_events_helper.rb', line 34

def elevation_tag(collecting_event)
  return nil if collecting_event.nil?
  [
    Utilities::Strings.nil_wrap(nil, [collecting_event.minimum_elevation, collecting_event.maximum_elevation].compact.join('-'), 'm'), 
    Utilities::Strings.nil_wrap(' +/-', collecting_event.elevation_precision, nil)
  ].compact.join.html_safe
end


18
19
20
21
22
23
24
# File 'app/helpers/collecting_events_helper.rb', line 18

def next_without_georeference_for_google_maps_link(collecting_event)
  if n = collecting_event.next_without_georeference
    link_to('Skip to next CE without georeference', new_georeferences_google_map_path(georeference: {collecting_event_id: n.to_param}), id: :next_without_georeference)
  else
    nil
  end
end

- (String?) verbatim_gis_tag(collecting_event)

Returns summary of verbatim gis related data

Returns:

  • (String, nil)

    summary of verbatim gis related data



51
52
53
54
55
56
57
58
# File 'app/helpers/collecting_events_helper.rb', line 51

def verbatim_gis_tag(collecting_event)
  return if collecting_event.nil?
  [collecting_event.verbatim_latitude, 
   collecting_event.verbatim_longitude,
   Utilities::Strings.nil_wrap(' (+/-', collecting_event.verbatim_geolocation_uncertainty, ')'),
   Utilities::Strings.nil_wrap(' [via ', collecting_event.verbatim_datum, ']'),
  ].compact.join(', ')
end