Module: ControlledVocabularyTermsHelper

Defined in:
app/helpers/controlled_vocabulary_terms_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) color_tag(css_color = nil, value)

TODO: make the color an attribute and apply it after, give a border



26
27
28
29
# File 'app/helpers/controlled_vocabulary_terms_helper.rb', line 26

def color_tag(css_color = nil, value)
  return value if css_color.nil?
  (:span, value, style: "background-color: #{css_color};")
end


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

def controlled_vocabulary_term_link(controlled_vocabulary_term)
  return nil if controlled_vocabulary_term.nil?
  link_to(controlled_vocabulary_term_tag(controlled_vocabulary_term.metamorphosize).html_safe, controlled_vocabulary_term.metamorphosize)
end

- (Object) controlled_vocabulary_term_tag(controlled_vocabulary_term)



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

def controlled_vocabulary_term_tag(controlled_vocabulary_term)
  return nil if controlled_vocabulary_term.nil?
  (:span, color_tag(controlled_vocabulary_term.css_color, controlled_vocabulary_term.name), title: controlled_vocabulary_term.definition)
end

- (Object) controlled_vocabulary_term_type_select_options



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

def controlled_vocabulary_term_type_select_options
  %w[Keyword Topic Predicate BiologicalProperty BiocurationGroup BiocurationClass ConfidenceLevel]
end

- (Object) controlled_vocabulary_terms_search_form



21
22
23
# File 'app/helpers/controlled_vocabulary_terms_helper.rb', line 21

def controlled_vocabulary_terms_search_form
  render('/controlled_vocabulary_terms/quick_search_form')
end

- (Object) term_and_definition_tag(controlled_vocabulary_term)



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

def term_and_definition_tag(controlled_vocabulary_term)
  (:span, controlled_vocabulary_term) + ': ' + (:span, controlled_vocabulary_term.definition)
end