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_is_primary_type(type_material)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    !! Only (currently) meaningful for ICN and ICZN - returns true for all other codes !!. 
- #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
| 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_select ⇒ Object
| 50 51 52 | # File 'app/helpers/type_materials_helper.rb', line 50 def ((TypeMaterial::ICZN_TYPES.keys + TypeMaterial::ICN_TYPES.keys).uniq.sort, selected: 'holotype') end | 
#type_material_is_primary_type(type_material) ⇒ Object
!! Only (currently) meaningful for ICN and ICZN - returns true for all other codes !!
| 56 57 58 59 60 61 62 | # File 'app/helpers/type_materials_helper.rb', line 56 def type_material_is_primary_type(type_material) (type_material.protonym.nomenclatural_code == :iczn && ::ICZN_PRIMARY_TYPES.include?(type_material.type_type)) || (type_material.protonym.nomenclatural_code == :icn && ::ICN_PRIMARY_TYPES.include?(type_material.type_type)) || ![:icn, :iczn].include?(type_material.protonym.nomenclatural_code) end | 
#type_material_link(type_material) ⇒ Object
| 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
| 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_form ⇒ Object
| 46 47 48 | # File 'app/helpers/type_materials_helper.rb', line 46 def type_materials_search_form render('/type_materials/quick_search_form') end |