Module: Maglev::Form::Inputs::TextField
- Included in:
- FormBuilder
- Defined in:
- app/lib/maglev/form/inputs/text_field.rb
Instance Method Summary collapse
- #text_field(method, options = {}) ⇒ Object
- #text_field_component_html_options(options) ⇒ Object
- #text_field_component_options(method, options) ⇒ Object
Instance Method Details
#text_field(method, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/lib/maglev/form/inputs/text_field.rb', line 7 def text_field(method, = {}) attributes = field_attributes(method) @template.render(Maglev::Uikit::Form::TextFieldComponent.new( label: [:label].presence || attributes[:content], name: attributes[:name], options: (method, ), html_options: () )) end |
#text_field_component_html_options(options) ⇒ Object
26 27 28 |
# File 'app/lib/maglev/form/inputs/text_field.rb', line 26 def () [:html_options] || {} end |
#text_field_component_options(method, options) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/lib/maglev/form/inputs/text_field.rb', line 18 def (method, ) { value: .key?(:value) ? [:value] : object.public_send(method), placeholder: [:placeholder], error: (method) } end |