Module: TaxonNameClassificationsHelper

Defined in:
app/helpers/taxon_name_classifications_helper.rb

Instance Method Summary (collapse)

Instance Method Details



8
9
10
11
# File 'app/helpers/taxon_name_classifications_helper.rb', line 8

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)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/taxon_name_classifications_helper.rb', line 14

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



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

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)



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

def taxon_name_classification_tag(taxon_name_classification)
  return nil if taxon_name_classification.nil?
  full_taxon_name_tag(taxon_name_classification.taxon_name) + ' (' + 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



52
53
54
# File 'app/helpers/taxon_name_classifications_helper.rb', line 52

def taxon_name_classifications_recent_objects_partial
  true 
end