Module: StimulusPlumbers::Form::Fields::Inputs::Select::Weekday

Included in:
Builder
Defined in:
lib/stimulus_plumbers/form/fields/inputs/select/weekday.rb

Instance Method Summary collapse

Instance Method Details

#weekday_select(attribute, options = {}, html_options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/stimulus_plumbers/form/fields/inputs/select/weekday.rb', line 10

def weekday_select(attribute, options = {}, html_options = {})
  html_native   = options.delete(:html_native) { false }
  icon_leading  = options.delete(:icon_leading)
  icon_trailing = options.delete(:icon_trailing) { "chevron-down" }
  icons         = { icon_leading: icon_leading, icon_trailing: icon_trailing }
  with_select_field(attribute, options, html_options) do |opts, merged, error|
    if html_native
      super(attribute, opts, merged)
    else
      render_select_dropdown(attribute, opts, merged, err: error, **icons) do
        build_weekday_choices(opts)
      end
    end
  end
end