Class: Eac::CommonFormHelper::FormBuilder
- Inherits:
-
Object
- Object
- Eac::CommonFormHelper::FormBuilder
- Includes:
- AssociationSelectField, CommonTextFields, CurrencyField, DateField, FieldsFor, FileField, RadioSelectField, SelectField, TimeField, YearMonthField
- Defined in:
- lib/eac/common_form_helper/form_builder.rb,
lib/eac/common_form_helper/form_builder/date_field.rb,
lib/eac/common_form_helper/form_builder/fields_for.rb,
lib/eac/common_form_helper/form_builder/file_field.rb,
lib/eac/common_form_helper/form_builder/time_field.rb,
lib/eac/common_form_helper/form_builder/select_field.rb,
lib/eac/common_form_helper/form_builder/currency_field.rb,
lib/eac/common_form_helper/form_builder/year_month_field.rb,
lib/eac/common_form_helper/form_builder/common_text_fields.rb,
lib/eac/common_form_helper/form_builder/radio_select_field.rb,
lib/eac/common_form_helper/form_builder/association_select_field.rb,
lib/eac/common_form_helper/form_builder/searchable_association_field.rb
Defined Under Namespace
Modules: AssociationSelectField, CommonTextFields, CurrencyField, DateField, FieldsFor, FileField, RadioSelectField, SelectField, TimeField, YearMonthField Classes: SearchableAssociationField
Instance Attribute Summary collapse
-
#field_errors_showed ⇒ Object
readonly
Returns the value of attribute field_errors_showed.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#helper ⇒ Object
readonly
Returns the value of attribute helper.
Instance Method Summary collapse
- #check_box_field(field_name, options = {}) ⇒ Object
- #file_field(field_name, options = {}) ⇒ Object
- #hidden_field(field_name, options = {}) ⇒ Object
-
#initialize(form, helper) ⇒ FormBuilder
constructor
A new instance of FormBuilder.
- #model_instance ⇒ Object
- #searchable_association_field(field_name, options = {}) ⇒ Object
Methods included from YearMonthField
Methods included from TimeField
Methods included from SelectField
Methods included from FieldsFor
Methods included from RadioSelectField
Methods included from DateField
Methods included from CurrencyField
Methods included from AssociationSelectField
Constructor Details
#initialize(form, helper) ⇒ FormBuilder
Returns a new instance of FormBuilder.
19 20 21 22 23 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 19 def initialize(form, helper) @form = form @helper = helper @field_errors_showed = Set.new end |
Instance Attribute Details
#field_errors_showed ⇒ Object (readonly)
Returns the value of attribute field_errors_showed.
17 18 19 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 17 def field_errors_showed @field_errors_showed end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
17 18 19 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 17 def form @form end |
#helper ⇒ Object (readonly)
Returns the value of attribute helper.
17 18 19 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 17 def helper @helper end |
Instance Method Details
#check_box_field(field_name, options = {}) ⇒ Object
33 34 35 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 33 def check_box_field(field_name, = {}) field(field_name, ) { @form.check_box(field_name, ) } end |
#file_field(field_name, options = {}) ⇒ Object
37 38 39 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 37 def file_field(field_name, = {}) field(field_name, ) { @form.file_field(field_name, ) } end |
#hidden_field(field_name, options = {}) ⇒ Object
29 30 31 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 29 def hidden_field(field_name, = {}) @form.hidden_field(field_name, ) end |
#model_instance ⇒ Object
25 26 27 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 25 def model_instance form.object end |
#searchable_association_field(field_name, options = {}) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/eac/common_form_helper/form_builder.rb', line 41 def searchable_association_field(field_name, = {}) saf = SearchableAssociationField.new(self, field_name, ) saf.hidden_input << field(field_name, ) { saf.visible_input } << saf.javascript_tag end |