Class: StimulusPlumbers::Form::Builder

Constant Summary

Constants included from Fields::Inputs::Text

Fields::Inputs::Text::TEXT_FIELD_METHODS

Instance Method Summary collapse

Methods included from Fields::Inputs::TextArea

#text_area

Methods included from Fields::Inputs::Submit

#submit

Methods included from Fields::Inputs::Select::Weekday

#weekday_select

Methods included from Fields::Inputs::Select::Timezone

#time_zone_select

Methods included from Fields::Inputs::Select::Grouped

#grouped_collection_select

Methods included from Fields::Inputs::Select

#collection_select, #select

Methods included from Fields::Inputs::Search

#search_field

Methods included from Fields::Inputs::Password

#password_field

Methods included from Fields::Inputs::File

#file_field

Methods included from Fields::Inputs::Radio

#collection_radio_buttons, #radio_button

Methods included from Fields::Inputs::Datetime

#date_field, #time_field

Methods included from Fields::Inputs::Checkbox

#check_box, #collection_check_boxes

Methods included from Plumber::Options::Aria

#labelled_aria

Methods included from Plumber::Options::Html

#merge_html_options

Instance Method Details

#choice(attribute, as:, collection: nil, value_method: nil, text_method: nil, **options) ⇒ Object



58
59
60
61
62
# File 'lib/stimulus_plumbers/form/builder.rb', line 58

def choice(attribute, as:, collection: nil, value_method: nil, text_method: nil, **options)
  field_opts = options.slice(*Field::OPTIONS)
  input_opts = options.except(*Field::OPTIONS)
  render_choice_field(as, attribute, field_opts, collection, value_method, text_method, input_opts)
end

#collection_field(attribute, as:, collection:, value_method:, text_method:, **options) ⇒ Object



52
53
54
55
56
# File 'lib/stimulus_plumbers/form/builder.rb', line 52

def collection_field(attribute, as:, collection:, value_method:, text_method:, **options)
  field_opts = options.slice(*Field::OPTIONS)
  input_opts = options.except(*Field::OPTIONS)
  render_collection_field(as, attribute, field_opts, collection, value_method, text_method, input_opts)
end

#field(attribute, as:, **options) ⇒ Object



46
47
48
49
50
# File 'lib/stimulus_plumbers/form/builder.rb', line 46

def field(attribute, as:, **options)
  field_opts = options.slice(*Field::OPTIONS)
  input_opts = options.except(*Field::OPTIONS)
  render_field(as, attribute, field_opts, input_opts)
end