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) ⇒ Object



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

def preparation_type_autocomplete_tag(preparation_type)
  preparation_type_tag(preparation_type)
end


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

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_formObject



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

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

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



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

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