Module: Bh::FormBuilder::Comboboxes
- Included in:
- Bh::FormBuilder
- Defined in:
- lib/bh/form_builder/comboboxes.rb
Overview
The menu the bundle draws as a combobox: Bootstrap's toggle and a searchable menu built from a select it then hides, which stays the one thing the form submits.
Constant Summary collapse
- WORDS =
The words the menu is read by, which belong to the gem rather than to a page.
i[all clear more no_results search].freeze
Instance Method Summary collapse
-
#combobox(method, choices = nil, options = {}, html_options = {}) ⇒ Object
methodas a combobox overchoices-- the selectform.selectwould draw, carrying what the bundle needs to draw it as one instead.
Instance Method Details
#combobox(method, choices = nil, options = {}, html_options = {}) ⇒ Object
method as a combobox over choices -- the select form.select would draw, carrying
what the bundle needs to draw it as one instead. Every argument is that select's, and
its own :prompt is what the toggle says before anything is picked. The words it is
searched, cleared and emptied by are the gem's, in the reader's own language, and
data given in html_options is kept over any of them.
16 17 18 19 20 21 |
# File 'lib/bh/form_builder/comboboxes.rb', line 16 def combobox(method, choices = nil, = {}, = {}, &) data = { controller: 'combobox', combobox_placeholder_value: [:prompt], **bh_combobox_words, **.fetch(:data, {}), } select method, choices, , .merge(data: data), & end |