Module: BiologicalRelationshipsHelper

Defined in:
app/helpers/biological_relationships_helper.rb

Instance Method Summary collapse

Instance Method Details



13
14
15
16
# File 'app/helpers/biological_relationships_helper.rb', line 13

def biological_relationship_link(biological_relationship)
  return nil if biological_relationship.nil?
  link_to(biological_relationship_tag(biological_relationship).html_safe, biological_relationship)
end

#biological_relationship_tag(biological_relationship) ⇒ Object



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

def biological_relationship_tag(biological_relationship)
  return nil if biological_relationship.nil?
  [biological_relationship.name, biological_relationship.inverted_name].compact.join(' / ')
end

#biological_relationship_types(biological_relationship) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/biological_relationships_helper.rb', line 22

def biological_relationship_types(biological_relationship)
  r = {
    subject: [],
    object: []
  }

  biological_relationship.biological_relationship_types.each do |p|
    r[p.target.to_sym].push p.biological_property.name
  end

  r
end

#biological_relationships_search_formObject



18
19
20
# File 'app/helpers/biological_relationships_helper.rb', line 18

def biological_relationships_search_form
  render('/biological_relationships/quick_search_form')
end

#label_for_biological_relationship(biological_relationship) ⇒ Object



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

def label_for_biological_relationship(biological_relationship)
  return nil if biological_relationship.nil?
  biological_relationship.name
end