Module: TaxonNameRelationshipsHelper

Defined in:
app/helpers/taxon_name_relationships_helper.rb

Instance Method Summary collapse

Instance Method Details

#taxon_name_relationship_for_object_tag(taxon_name_relationship) ⇒ String

Returns relationship_type + object

Returns:

  • (String)

    relationship_type + object



29
30
31
32
33
34
35
# File 'app/helpers/taxon_name_relationships_helper.rb', line 29

def taxon_name_relationship_for_object_tag(taxon_name_relationship)
  [
    (:span, taxon_name_relationship.object_status_tag, class: :string_emphasis),
    original_taxon_name_link(taxon_name_relationship.subject_taxon_name),
    taxon_name_relationship.subject_taxon_name.cached_author_year
  ].join(' ').html_safe  
end

#taxon_name_relationship_for_subject_tag(taxon_name_relationship) ⇒ String

Returns subject + relationship type

Returns:

  • (String)

    subject + relationship type



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

def taxon_name_relationship_for_subject_tag(taxon_name_relationship)
  return nil if taxon_name_relationship.nil?
  [
    (:span, taxon_name_relationship.subject_status_tag , class: :string_emphasis),
    original_taxon_name_link(taxon_name_relationship.object_taxon_name),
    taxon_name_relationship.object_taxon_name.cached_author_year
  ].join(' ').html_safe  
end

#taxon_name_relationship_tag(taxon_name_relationship) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/taxon_name_relationships_helper.rb', line 3

def taxon_name_relationship_tag(taxon_name_relationship)
  return nil if taxon_name_relationship.nil?
  [
    taxon_name_browse_link(taxon_name_relationship.subject_taxon_name),
    #      taxon_name_relationship.subject_taxon_name.cached_author_year ,
    (:span, ( defined?(taxon_name_relationship.class.assignment_method) ? 
                        taxon_name_relationship.class.assignment_method.to_s.humanize : 
                        taxon_name_relationship.type ),
                        class: :subtle),
                        taxon_name_browse_link(taxon_name_relationship.object_taxon_name),
  ].compact.join(' ')
end

#type_taxon_name_relationship_tag(taxon_name_relationship, target: :browse_nomenclature_task_path) ⇒ Object



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

def type_taxon_name_relationship_tag(taxon_name_relationship, target: :browse_nomenclature_task_path)
  return nil if taxon_name_relationship.nil?
  # TODO: add original citation to relationship rendering
  (:span, [ taxon_name_relationship.subject_status.capitalize,
                       link_to( original_taxon_name_tag( taxon_name_relationship.subject_taxon_name), send(target, taxon_name_id: taxon_name_relationship.subject_taxon_name.id)),
                       original_author_year(taxon_name_relationship.subject_taxon_name)].join(' ').html_safe, class: 'type_information'
             )
end