Module: Maglev::Form::Inputs::Select
- Included in:
- FormBuilder
- Defined in:
- app/lib/maglev/form/inputs/select.rb
Instance Method Summary collapse
- #select(method, select_options, options = {}) ⇒ Object
- #select_component_html_options(options) ⇒ Object
- #select_component_options(method, options) ⇒ Object
Instance Method Details
#select(method, select_options, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/lib/maglev/form/inputs/select.rb', line 7 def select(method, , = {}) attributes = field_attributes(method) @template.render(Maglev::Uikit::Form::SelectComponent.new( label: [:label].presence || attributes[:content], name: attributes[:name], choices: , options: (method, ), html_options: () )) end |
#select_component_html_options(options) ⇒ Object
28 29 30 |
# File 'app/lib/maglev/form/inputs/select.rb', line 28 def () [:html_options] || {} end |
#select_component_options(method, options) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/lib/maglev/form/inputs/select.rb', line 19 def (method, ) { value: .key?(:value) ? [:value] : object.public_send(method), prompt: [:prompt], include_blank: [:include_blank], error: (method) } end |