Module: PreparationTypesHelper

Defined in:
app/helpers/preparation_types_helper.rb

Instance Method Summary collapse

Instance Method Details

#label_for_preparation_type(preparation_type) ⇒ Object



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

def label_for_preparation_type(preparation_type)
  return nil if preparation_type.nil?
  preparation_type.name
end

#preparation_type_autocomplete_tag(preparation_type, term = nil) ⇒ Object



13
14
15
16
17
18
# File 'app/helpers/preparation_types_helper.rb', line 13

def preparation_type_autocomplete_tag(preparation_type, term = nil)
  mark_tag(
    (:span, safe_join([preparation_type_tag(preparation_type), ': ', preparation_type.definition])),
    term
  )
end


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

def preparation_type_link(preparation_type)
  return nil if preparation_type.nil?
  link_to(preparation_type_tag(preparation_type).html_safe, preparation_type)
end

#preparation_type_tag(preparation_type) ⇒ Object



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

def preparation_type_tag(preparation_type)
  return nil if preparation_type.nil?
  preparation_type.name
end

#preparation_types_search_form ⇒ Object



25
26
27
# File 'app/helpers/preparation_types_helper.rb', line 25

def preparation_types_search_form
  render('/preparation_types/quick_search_form')
end

#preparation_types_select(selected: nil, preparation_types: PreparationType.all.to_a) ⇒ Object



29
30
31
# File 'app/helpers/preparation_types_helper.rb', line 29

def preparation_types_select(selected: nil, preparation_types: PreparationType.all.to_a)
  select_tag('preparation_type[id]' , options_from_collection_for_select(preparation_types, :id, :name, selected.try(:id)), include_blank: true)
end