Method: Satis::Dropdown::Component#initialize
- Defined in:
- app/components/satis/dropdown/component.rb
#initialize(form:, attribute:, **options, &block) ⇒ Component
Returns a new instance of Component.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/satis/dropdown/component.rb', line 8 def initialize(form:, attribute:, **, &block) super @form = form @attribute = attribute @title = title @options = @url = [:url] @chain_to = [:chain_to] @free_text = [:free_text] @needs_exact_match = [:needs_exact_match] @reset_button = [:reset_button] || [:include_blank] [:input_html] ||= {} [:input_html][:value] = hidden_value [:input_html][:autofocus] ||= false if [:input_html][:autofocus] [:autofocus] = 'autofocus' [:input_html].delete(:autofocus) end actions = [[:input_html]['data-action'], 'change->satis-dropdown#display', 'focus->satis-dropdown#focus'].join(' ') [:input_html].merge!('data-satis-dropdown-target' => 'hiddenInput', 'data-action' => actions) @block = block @page_size = [:page_size] || 10 end |