Module: TaxonDeterminationsHelper

Defined in:
app/helpers/taxon_determinations_helper.rb

Instance Method Summary collapse

Instance Method Details

#determination_tag(taxon_determination) ⇒ String

Returns as for taxon_determination_tag but does not reference collection object.

Returns:

  • (String)

    as for taxon_determination_tag but does not reference collection object



12
13
14
15
16
17
18
# File 'app/helpers/taxon_determinations_helper.rb', line 12

def determination_tag(taxon_determination)
  return nil if taxon_determination.nil?
  [ otu_tag(taxon_determination.otu),
    taxon_determination_by(taxon_determination),
    taxon_determination_on(taxon_determination)
  ].compact.join(' ').html_safe
end

#label_for_taxon_determination(taxon_determination) ⇒ Object



20
21
22
23
24
25
# File 'app/helpers/taxon_determinations_helper.rb', line 20

def label_for_taxon_determination(taxon_determination)
  [ label_for_otu(taxon_determination.otu),
    taxon_determination_by(taxon_determination),
    taxon_determination_on(taxon_determination)
  ].compact.join(' ')
end

#taxon_determination_by(taxon_determination) ⇒ String

Returns the “by” clause of the determination.

Returns:

  • (String)

    the “by” clause of the determination



35
36
37
38
39
40
41
42
# File 'app/helpers/taxon_determinations_helper.rb', line 35

def taxon_determination_by(taxon_determination)
  names = [
    taxon_determination.determiners.collect{|d| d.last_name },
    taxon_determination.determiners_organization.collect{|d| d.name }
  ].reduce([], :concat).to_sentence

  names.blank? ? nil : "by #{names}"
end

Returns as for taxon_determination_tag but does not reference collection object, links to OTU.

Returns:

  • (String)

    as for taxon_determination_tag but does not reference collection object, links to OTU



29
30
31
# File 'app/helpers/taxon_determinations_helper.rb', line 29

def taxon_determination_link(taxon_determination)
  link_to(determination_tag(taxon_determination), browse_otus_task_path(taxon_determination.otu))
end

#taxon_determination_on(taxon_determination) ⇒ String

Returns the date clause of the determination.

Returns:

  • (String)

    the date clause of the determination



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

def taxon_determination_on(taxon_determination)
  !taxon_determination.date.blank? ? "on #{taxon_determination.date}" : nil
end

#taxon_determination_tag(taxon_determination) ⇒ String?

Returns a descriptor, contains name only (if you want to include the identifier use collection_object_tag).

Returns:

  • (String, nil)

    a descriptor, contains name only (if you want to include the identifier use collection_object_tag)



5
6
7
8
# File 'app/helpers/taxon_determinations_helper.rb', line 5

def taxon_determination_tag(taxon_determination)
  return nil if taxon_determination.nil?
  ['det.', determination_tag(taxon_determination) ].join(' ').html_safe
end