Module: OtuRelationshipsHelper

Defined in:
app/helpers/otu_relationships_helper.rb

Instance Method Summary collapse

Instance Method Details

#otu_relationship_label(otu_relationship) ⇒ Object



8
9
10
11
12
13
14
# File 'app/helpers/otu_relationships_helper.rb', line 8

def otu_relationship_label(otu_relationship)
  return nil if otu_relationship.nil?
  [
    label_for_otu(otu_relationship.subject_otu),
    tag.span(otu_relationship_type_label(otu_relationship), class: [:feedback, 'feedback-thin', 'feedback-info']),
    label_for_otu(otu_relationship.object_otu) ].compact.join(' ').html_safe
end


16
17
18
19
# File 'app/helpers/otu_relationships_helper.rb', line 16

def otu_relationship_link(otu_relationship)
  return nil if otu_relationship.nil?
  link_to(otu_relationship_label(otu_relationship), otu_relationship.metamorphosize)
end

#otu_relationship_tag(otu_relationship) ⇒ Object



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

def otu_relationship_tag(otu_relationship)
  return nil if otu_relationship.nil?
  [otu_tag(otu_relationship.subject_otu), otu_relationship_type_label(otu_relationship), otu_tag(otu_relationship.object_otu) ].compact.join(' ')
end

#otu_relationship_type_label(otu_relationship) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/helpers/otu_relationships_helper.rb', line 21

def otu_relationship_type_label(otu_relationship)
  return nil if otu_relationship.nil?
  case otu_relationship.type
  when 'OtuRelationship::Disjoint'
    'disjoint'
  when 'OtuRelationship::Equal'
    'equals'
  when 'OtuRelationship::Intersecting'
    'intersecting'
  when 'OtuRelationship::PartiallyOverlapping'
    'overlaps'
  when 'OtuRelationship::ProperPartInverse'
    'includes'
  when 'OtuRelationship::ProperPart'
     'included in'
  end

end