Module: ProtocolsHelper

Defined in:
app/helpers/protocols_helper.rb

Instance Method Summary collapse

Instance Method Details



26
27
28
29
30
31
# File 'app/helpers/protocols_helper.rb', line 26

def add_protocol_link(object: nil, attribute: nil)
  link_to('Add protocol', new_protocol_relationship_path(protocol_relationship: {
    protocol_object_type: object.class.base_class.name,
    protocol_object_id: object.id,
    protocol_object_attribute: attribute})) if object.has_protocols?
end

#label_for_protocol(protocol) ⇒ Object



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

def label_for_protocol(protocol)
  return nil if protocol.nil?
  protocol.name
end

#protocol_autocomplete_selected_tag(protocol) ⇒ Object



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

def protocol_autocomplete_selected_tag(protocol)
  return nil if protocol.nil?
  protocol_tag(protocol)
end


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

def protocol_link(protocol)
  return nil if protocol.nil?
  link_to(protocol_tag(protocol).html_safe, protocol)
end

#protocol_tag(protocol) ⇒ Object



2
3
4
5
# File 'app/helpers/protocols_helper.rb', line 2

def protocol_tag(protocol)
  return nil if protocol.nil?
  protocol.name
end

#protocols_search_formObject



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

def protocols_search_form
  render('/protocols/quick_search_form')
end