Module: TaxonNameClassificationsHelper

Defined in:
app/helpers/taxon_name_classifications_helper.rb

Instance Method Summary (collapse)

Instance Method Details

Returns:

  • (link)


32
33
34
35
# File 'app/helpers/taxon_name_classifications_helper.rb', line 32

def taxon_name_classification_link(taxon_name_classification)
  return nil if taxon_name_classification.nil?
  link_to(taxon_name_classification_tag(taxon_name_classification).html_safe, metamorphosize_if(taxon_name_classification.taxon_name))
end

- (Object) taxon_name_classification_options(taxon_name)



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/taxon_name_classifications_helper.rb', line 4

def taxon_name_classification_options(taxon_name)
  o = []

  if taxon_name.rank_class

  case taxon_name.rank_class.nomenclatural_code
    when :icn
      o = ICN_TAXON_NAME_CLASSIFICATION_HASH
    when :iczn
      o =  ICZN_TAXON_NAME_CLASSIFICATION_HASH
    else # should never be hit ...
      o = ICZN_TAXON_NAME_CLASSIFICATION_HASH.merge(ICN_TAXON_NAME_CLASSIFICATION_HASH)
  end

  else # taxon_name is a new record
    o = ICZN_TAXON_NAME_CLASSIFICATION_HASH.merge(ICN_TAXON_NAME_CLASSIFICATION_HASH)
  end

  options_for_select(o)
end

- (String) taxon_name_classification_status_tag(taxon_name)

Returns a span summarizing taxon name classification

Returns:

  • (String)

    a span summarizing taxon name classification



39
40
41
42
43
44
45
46
47
48
# File 'app/helpers/taxon_name_classifications_helper.rb', line 39

def taxon_name_classification_status_tag(taxon_name)
  if taxon_name.unavailable_or_invalid?  
    values = TaxonNameClassification.where_taxon_name(taxon_name).with_type_array(ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES).collect{|c| 
      c.classification_label}.uniq.sort

    (:span, "Is an  #{values.to_sentence} name.", class: [:brief_status], data: [ 'icon-alert' ])  
  else
    (:span, "Is a valid name.", class: [:brief_status, :passed])  
  end 
end

- (Object) taxon_name_classification_tag(taxon_name_classification)



25
26
27
28
# File 'app/helpers/taxon_name_classifications_helper.rb', line 25

def taxon_name_classification_tag(taxon_name_classification)
  return nil if taxon_name_classification.nil?
  taxon_name_classification.classification_label
end

- (True) taxon_name_classifications_recent_objects_partial

Returns indicates a custom partial should be used, see list_helper.rb

Returns:

  • (True)

    indicates a custom partial should be used, see list_helper.rb



54
55
56
# File 'app/helpers/taxon_name_classifications_helper.rb', line 54

def taxon_name_classifications_recent_objects_partial
  true 
end