Class: ItemPickerTomSelectInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- ItemPickerTomSelectInput
- Defined in:
- app/inputs/item_picker_tom_select_input.rb
Overview
Tom Select version of ItemPickerInput
Use as: :item_picker_tom_select instead of :item_picker
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
13 14 15 16 17 |
# File 'app/inputs/item_picker_tom_select_input.rb', line 13 def collection return [] unless selected_value Item.where(id: selected_value).map { |i| [i.to_s, i.id] } end |
#input(wrapper_options = nil) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/inputs/item_picker_tom_select_input.rb', line 4 def input( = nil) [:data] ||= {} query_params = [:query_params] || [:query_params] || {} [:data]['tom-select-suggest-url-value'] = template.lookup_items_path(query_params) [:data]['tom-select-min-chars-value'] = 0 super end |