Class: PartyPickerTomSelectInput

Inherits:
TomSelectInput
  • Object
show all
Defined in:
app/inputs/party_picker_tom_select_input.rb

Overview

Tom Select version of PartyPickerInput
Use as: :party_picker_tom_select instead of :party_picker

Instance Method Summary collapse

Methods inherited from TomSelectInput

#input_html_classes

Instance Method Details

#collectionObject



12
13
14
15
16
# File 'app/inputs/party_picker_tom_select_input.rb', line 12

def collection
  return [] unless selected_value

  Party.where(id: selected_value).pluck(:full_name, :id)
end

#input(wrapper_options = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'app/inputs/party_picker_tom_select_input.rb', line 4

def input(wrapper_options = nil)
  input_html_options[:data] ||= {}
  input_html_options[:data]['tom-select-suggest-url-value'] = '/parties/lookup'
  input_html_options[:data]['tom-select-min-chars-value'] = 0

  super
end