Module: TypeMaterialsHelper

Defined in:
app/helpers/type_materials_helper.rb

Instance Method Summary collapse

Instance Method Details

#label_for_type_material(type_material) ⇒ Object



16
17
18
19
# File 'app/helpers/type_materials_helper.rb', line 16

def label_for_type_material(type_material)
  return nil if type_material.nil?
  [type_material.type_type, full_original_taxon_name_label(type_material.protonym)].compact.join(' of ')
end

#options_for_type_type_selectObject



50
51
52
# File 'app/helpers/type_materials_helper.rb', line 50

def options_for_type_type_select
  options_for_select((TypeMaterial::ICZN_TYPES.keys + TypeMaterial::ICN_TYPES.keys).uniq.sort, selected: 'holotype')
end


11
12
13
14
# File 'app/helpers/type_materials_helper.rb', line 11

def type_material_link(type_material)
  return nil if type_material.nil?
  link_to(type_material_tag(type_material).html_safe, type_material)
end

#type_material_tag(type_material) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/type_materials_helper.rb', line 3

def type_material_tag(type_material)
  return nil if type_material.nil?
  [
    type_material.type_type,
full_original_taxon_name_tag(type_material.protonym)
    ].compact.join(' of ')
end

#type_material_to_geo_json_feature(type_material, base = true) ⇒ GeoJson feature

Parameters:

  • base (Boolean) (defaults to: true)

Returns:

  • (GeoJson feature)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/helpers/type_materials_helper.rb', line 24

def type_material_to_geo_json_feature(type_material, base = true)
  return nil if type_material.nil?
  if a = collection_object_to_geo_json_feature(type_material.collection_object, false)
    l = label_for_type_material(type_material)
    a['properties']['target'] = {
      'type' => 'TypeMaterial',
      'id' => type_material.id,
      'label' => l
    }
    if base
      a['properties']['base'] = {
        'type' => 'TypeMaterial',
        'id' => type_material.id,
        'label' => l
      }
    end
    a
  else
    nil
  end
end

#type_materials_search_formObject



46
47
48
# File 'app/helpers/type_materials_helper.rb', line 46

def type_materials_search_form
  render('/type_materials/quick_search_form')
end