Class: LedgerCompanyAccountPickerTomSelectInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- LedgerCompanyAccountPickerTomSelectInput
- Defined in:
- app/inputs/ledger_company_account_picker_tom_select_input.rb
Overview
Tom Select version of LedgerCompanyAccountPickerInput
Use as: :ledger_company_account_picker_tom_select
Supports remote search via /ledger_company_accounts/lookup endpoint
Pass company_id via query_params to filter by company
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
15 16 17 18 19 |
# File 'app/inputs/ledger_company_account_picker_tom_select_input.rb', line 15 def collection return [] unless selected_value LedgerCompanyAccount.where(id: selected_value).map { |a| [a.identifier_and_name, a.id] } end |
#input(wrapper_options = nil) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/inputs/ledger_company_account_picker_tom_select_input.rb', line 6 def input( = nil) [:data] ||= {} query_params = [:query_params] || [:query_params] || {} [:data]['tom-select-suggest-url-value'] = template.lookup_ledger_company_accounts_path(query_params) [:data]['tom-select-min-chars-value'] = 0 super end |