Module: BiologicalRelationshipsHelper

Defined in:
app/helpers/biological_relationships_helper.rb

Instance Method Summary collapse

Instance Method Details

#biological_relationship_autocomplete_tag(biological_relationship, term = nil) ⇒ Object



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

def biological_relationship_autocomplete_tag(biological_relationship, term = nil)
  mark_tag(biological_relationship_tag(biological_relationship), term)
end


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

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



26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/helpers/biological_relationships_helper.rb', line 26

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



22
23
24
# File 'app/helpers/biological_relationships_helper.rb', line 22

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

#label_for_biological_relationship(biological_relationship) ⇒ Object



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

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