Class: Godmin::FormBuilders::FormBuilder
- Inherits:
-
BootstrapForm::FormBuilder
- Object
- BootstrapForm::FormBuilder
- Godmin::FormBuilders::FormBuilder
- Defined in:
- lib/godmin/helpers/forms.rb
Instance Method Summary collapse
- #association(attribute, options = {}, html_options = {}) ⇒ Object
- #date_field(attribute, options = {}) ⇒ Object
- #datetime_field(attribute, options = {}) ⇒ Object
- #input(attribute, options = {}) ⇒ Object
Instance Method Details
#association(attribute, options = {}, html_options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/godmin/helpers/forms.rb', line 31 def association(attribute, = {}, = {}) case association_type(attribute) when :belongs_to select("#{attribute}_id", association_collection_for_select(attribute), , .deep_merge( data: { behavior: "select-box" } )) else input(attribute, ) end end |
#date_field(attribute, options = {}) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/godmin/helpers/forms.rb', line 42 def date_field(attribute, = {}) text_field(attribute, .deep_merge( value: datetime_value(attribute, , :datepicker), data: { behavior: "datepicker" } )) end |
#datetime_field(attribute, options = {}) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/godmin/helpers/forms.rb', line 49 def datetime_field(attribute, = {}) text_field(attribute, .deep_merge( value: datetime_value(attribute, , :datetimepicker), data: { behavior: "datetimepicker" } )) end |
#input(attribute, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/godmin/helpers/forms.rb', line 16 def input(attribute, = {}) case attribute_type(attribute) when :text text_area(attribute, ) when :boolean check_box(attribute, ) when :date date_field(attribute, ) when :datetime datetime_field(attribute, ) else text_field(attribute, ) end end |