Class: RoomConfigurationPickerInput

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

Instance Method Summary collapse

Methods inherited from TomSelectInput

#input_html_classes

Instance Method Details

#collectionObject



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

def collection
  # Ensure the current value renders as the selected option to avoid blank display
  RoomConfiguration.where(id: selected_value).map { |rc| [rc.reference_number, rc.id] }
end

#input(wrapper_options = nil) ⇒ Object



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

def input(wrapper_options = nil)
  input_html_options[:data] ||= {}
  default_url = '/room_configurations/lookup'
  input_html_options[:data]['tom-select-suggest-url-value'] ||= default_url
  # Allow override via options[:suggest_url]
  input_html_options[:data]['tom-select-suggest-url-value'] = options[:suggest_url] if options[:suggest_url].present?
  super
end