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
25
26
# 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 }
  Field.new(@template, **options).render(
    object,
    attribute,
    input_id: field_id(attribute)
  ) do |html_opts, opts, error|
    merged_html_opts = merge_html_options(html_options, html_opts, field_theme(:form_select, error: error))
    if html_native
      super(attribute, opts, merged_html_opts)
    else
      render_select_dropdown(attribute, opts, merged_html_opts, err: error) do
        build_weekday_choices(opts)
      end
    end
  end
end