Module: TypeMaterialsHelper
- Defined in:
- app/helpers/type_materials_helper.rb
Instance Method Summary collapse
- #label_for_type_material(type_material) ⇒ Object
- #options_for_type_type_select ⇒ Object
- #type_material_link(type_material) ⇒ Object
- #type_material_tag(type_material) ⇒ Object
- #type_material_to_geo_json_feature(type_material, base = true) ⇒ GeoJson feature
- #type_materials_search_form ⇒ Object
Instance Method Details
#label_for_type_material(type_material) ⇒ Object
13 14 15 16 |
# File 'app/helpers/type_materials_helper.rb', line 13 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_select ⇒ Object
47 48 49 |
# File 'app/helpers/type_materials_helper.rb', line 47 def ((TypeMaterial::ICZN_TYPES.keys + TypeMaterial::ICN_TYPES.keys).uniq.sort, selected: 'holotype') end |
#type_material_link(type_material) ⇒ Object
8 9 10 11 |
# File 'app/helpers/type_materials_helper.rb', line 8 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 |
# 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, link_to(full_original_taxon_name_tag(type_material.protonym), browse_nomenclature_task_path(taxon_name_id: type_material.protonym.id))].compact.join(' of ') end |
#type_material_to_geo_json_feature(type_material, base = true) ⇒ GeoJson feature
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/type_materials_helper.rb', line 21 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_form ⇒ Object
43 44 45 |
# File 'app/helpers/type_materials_helper.rb', line 43 def type_materials_search_form render('/type_materials/quick_search_form') end |