Class: TagsPickerInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- TagsPickerInput
- Defined in:
- app/inputs/tags_picker_input.rb
Overview
SimpleForm input wrapper: image tags picker backed by remote lookup
(/images/tags_lookup) so the filter panel never embeds all ~4k tags.
Instance Method Summary collapse
-
#collection ⇒ Object
Render only the currently-selected tags as options; remote search fills the rest.
- #input(wrapper_options = nil) ⇒ Object
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
Render only the currently-selected tags as options; remote search fills the rest.
15 16 17 18 |
# File 'app/inputs/tags_picker_input.rb', line 15 def collection values = Array([:selected]).presence || Array(selected_value) values.map { |tag| [tag, tag] } end |
#input(wrapper_options = nil) ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/inputs/tags_picker_input.rb', line 6 def input( = nil) [:multiple] = true if [:multiple].nil? [:data] ||= {} [:data]['tom-select-suggest-url-value'] = template. [:data]['tom-select-min-chars-value'] = 1 super end |