Class: PatientFormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ApplicationHelper, PatientsHelper
Defined in:
lib/patient_form_builder.rb

Constant Summary

Constant Summary

Constants included from PatientsHelper

PatientsHelper::HUMANIZE_FIXUPS

Instance Method Summary (collapse)

Methods included from PatientsHelper

#cycle_row, #humanize, #link_to_add_module, #link_to_module, #show_child_module, #show_children_module, #view_row

Methods included from SortOrderHelper

#link_to_sort, #sort_order_class

Methods included from ApplicationHelper

#current_controller?, #javascript_include_if_exists, #patient_form_for, #requirements_for

Instance Method Details

- (Object) address_fields

Render nested form fields for address.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/patient_form_builder.rb', line 59

def address_fields
  "".tap do |result|
    fields_for(:address) do |f|
      result << f.text_field(:street_address_line_one)
      result << f.text_field(:street_address_line_two)
      result << f.text_field(:city)
      result << f.select(:state, IsoState.select_options,
                         :include_blank => true)
      result << f.text_field(:postal_code)
      result << f.select(:iso_country_id, IsoCountry.select_options,
                         :include_blank => true)
    end
  end
end

- (Object) calendar_date_select(field, *args)



11
12
13
# File 'lib/patient_form_builder.rb', line 11

def calendar_date_select field, *args
  table_field field, super(field, *args)
end

- (Object) check_box(field, *args)



23
24
25
# File 'lib/patient_form_builder.rb', line 23

def check_box field, *args
  table_field(field, super(field, *args))
end

- (Object) collection_select(field, *args)



15
16
17
# File 'lib/patient_form_builder.rb', line 15

def collection_select field, *args
  table_field field, super(field, *args)
end

- (Object) person_name_fields

Render nested form fields for person_name.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/patient_form_builder.rb', line 32

def person_name_fields
  "".tap do |result|
    fields_for(:person_name) do |f|
      result << f.text_field(:name_prefix)
      result << f.text_field(:first_name)
      result << f.text_field(:middle_name)
      result << f.text_field(:last_name)
      result << f.text_field(:name_suffix)
    end
  end
end

- (Object) select(field, content, *args)



7
8
9
# File 'lib/patient_form_builder.rb', line 7

def select field, content, *args
  table_field field, super(field, content, *args)
end

- (Object) submit(label, *args)



27
28
29
# File 'lib/patient_form_builder.rb', line 27

def submit label, *args
  table_controls(super(label, *args))
end

- (Object) table_controls(content)



82
83
84
# File 'lib/patient_form_builder.rb', line 82

def table_controls content
  table_row((:td, '') + (:td, content))
end

- (Object) table_field(field, content)



74
75
76
77
78
79
80
# File 'lib/patient_form_builder.rb', line 74

def table_field field, content
  table_row(
    (:td,
      humanize(field) + ' ' + requirements_for(object, field),
      :class => 'lighttext') +
    (:td, content))
end

- (Object) table_row(content)



86
87
88
# File 'lib/patient_form_builder.rb', line 86

def table_row content
  (:tr, content, :class => cycle('lightzebra', 'darkzebra'))
end

- (Object) telecom_fields

Render nested form fields for telecom.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/patient_form_builder.rb', line 45

def telecom_fields
  "".tap do |result|
    fields_for(:telecom) do |f|
      result << f.text_field(:home_phone)
      result << f.text_field(:work_phone)
      result << f.text_field(:mobile_phone)
      result << f.text_field(:vacation_home_phone)
      result << f.text_field(:email)
      result << f.text_field(:url)
    end
  end
end

- (Object) text_field(field, *args)



19
20
21
# File 'lib/patient_form_builder.rb', line 19

def text_field field, *args
  table_field(field, super(field, *args))
end