Class: CustomerPickerTomSelectInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- CustomerPickerTomSelectInput
- Defined in:
- app/inputs/customer_picker_tom_select_input.rb
Overview
Tom Select version of CustomerPickerInput
Use as: :customer_picker_tom_select instead of :customer_picker
Supports remote search via /customers/lookup endpoint
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
13 14 15 16 17 |
# File 'app/inputs/customer_picker_tom_select_input.rb', line 13 def collection return [] unless selected_value Customer.where(id: selected_value).pluck(:full_name, :id) end |
#input(wrapper_options = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/inputs/customer_picker_tom_select_input.rb', line 5 def input( = nil) [:data] ||= {} [:data]['tom-select-suggest-url-value'] = template.lookup_customers_path [:data]['tom-select-min-chars-value'] = 0 super end |