Module: ConfidencesHelper

Defined in:
app/helpers/confidences_helper.rb

Instance Method Summary (collapse)

Instance Method Details



32
33
34
35
36
37
# File 'app/helpers/confidences_helper.rb', line 32

def add_confidence_link(object: nil)
  link_to('Add confidence', new_confidence_path( 
                                                confidence_object_type: object.class.base_class.name,
                                                confidence_object_id: object.id
                                               )) if object.has_confidences?
end

- (Object) confidence_annotation_confidence(confidence)



23
24
25
26
# File 'app/helpers/confidences_helper.rb', line 23

def confidence_annotation_confidence(confidence)
  return nil if confidence.nil?
  (:span, controlled_vocabulary_term_tag(confidence.confidence_level), class: [:annotation__confidence])
end


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

def confidence_link(confidence)
  return nil if confidence.nil?
  link_to(confidence_tag(confidence), confidence.confidence_object.metamorphosize)
end

- (String (html)?) confidence_list_tag(object)

Returns a ul/li of tags for the object

Returns:

  • (String (html), nil)

    a ul/li of tags for the object



15
16
17
18
19
20
21
# File 'app/helpers/confidences_helper.rb', line 15

def confidence_list_tag(object)
  return nil unless object.has_confidences? && object.confidences.any?
  (:h3, 'Confidences') +
    (:ul, class: 'annotations__confidences_list') do
    object.confidences.collect { |a| (:li, confidence_tag(a)) }.join.html_safe
  end
end

- (Object) confidence_tag(confidence)



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

def confidence_tag(confidence)
  return nil if confidence.nil?
  (:span, confidence.confidence_level.name, style: "background-color: #{confidence.confidence_level.css_color};")
end

- (Object) confidences_search_form



28
29
30
# File 'app/helpers/confidences_helper.rb', line 28

def confidences_search_form
  render('/confidences/quick_search_form')
end