Class: LedgerCompanyAccountPickerInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- LedgerCompanyAccountPickerInput
- Defined in:
- app/inputs/ledger_company_account_picker_input.rb
Overview
SimpleForm input: LedgerCompanyAccount picker with remote search.
Use as: :ledger_company_account_picker.
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
16 17 18 19 20 |
# File 'app/inputs/ledger_company_account_picker_input.rb', line 16 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
7 8 9 10 11 12 13 14 |
# File 'app/inputs/ledger_company_account_picker_input.rb', line 7 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 |