module Ariadne::Forms::Dsl::InputMethods
def action_menu(**options, &block)
-
block
(Proc
) -- The block passed to `#render` when the <%= link_to_component(Ariadne::Alpha::ActionMenu) %> is rendered. This block is passed an instance of <%= link_to_component(Ariadne::Alpha::ActionMenu) %>, which can be used to add items, dividers, etc. -
options
(Hash
) -- The options accepted by the <%= link_to_component(Ariadne::Alpha::ActionMenu) %> component.
def action_menu(**options, &block) options = decorate_options(**options) add_input(ActionMenuInput.new(builder: builder, form: form, **options, &block)) end
def add_input(input)
- Private: -
def add_input(input) inputs << input end
def auto_complete(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the autocomplete input (see forms docs).
def auto_complete(**options, &block) options = decorate_options(**options) add_input(AutoCompleteInput.new(builder: builder, form: form, **options, &block)) end
def button(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the button input (see forms docs).
def button(**options, &block) options = decorate_options(**options) add_input(ButtonInput.new(builder: builder, form: form, **options, &block)) end
def check_box(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the check box input (see forms docs).
def check_box(**options, &block) add_input(CheckBoxInput.new(builder: builder, form: form, **options, &block)) end
def check_box_group(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the check box group input (see forms docs).
def check_box_group(**options, &block) add_input(CheckBoxGroupInput.new(builder: builder, form: form, **options, &block)) end
def clipboard_copy_button(**options, &block)
def clipboard_copy_button(**options, &block) add_input(ClipboardCopyButton.new(builder: @builder, form: form, **options, &block)) end
def decorate_options(**options)
- Private: -
def decorate_options(**options) options end
def fields_for(*args, **kwargs, &block)
-
kwargs
(Hash
) -- The options accepted by the form reference input (see forms docs). Includes keyword arguments passed to Rails' [`fields_for` helper](https://api.rubyonrails.org/v7.0.4/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for). -
args
(Array
) -- Positional arguments passed to Rails' [`fields_for` helper](https://api.rubyonrails.org/v7.0.4/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for).
def fields_for(*args, **kwargs, &block) add_input(FormReferenceInput.new(*args, builder: builder, form: form, **kwargs, &block)) end
def hidden(**options)
-
options
(Hash
) -- The options accepted by the hidden input (see forms docs).
def hidden(**options) add_input(HiddenInput.new(builder: builder, form: form, **options)) end
def inputs
- Private: -
def inputs @inputs ||= [] end
def multi(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the multi input (see forms docs).
def multi(**options, &block) add_input(MultiInput.new(builder: builder, form: form, **options, &block)) end
def radio_button_group(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the radio button group input (see forms docs).
def radio_button_group(**options, &block) add_input(RadioButtonGroupInput.new(builder: builder, form: form, **options, &block)) end
def select_list(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the select list input (see forms docs).
def select_list(**options, &block) options = decorate_options(**options) add_input(SelectInput.new(builder: builder, form: form, **options, &block)) end
def separator
def separator add_input(Separator.new) end
def status(**options, &block)
def status(**options, &block) add_input(Status.new(builder: @builder, form: @form, **options, &block)) end
def submit(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the submit button input (see forms docs).
def submit(**options, &block) options = decorate_options(**options) add_input(SubmitButtonInput.new(builder: builder, form: form, **options, &block)) end
def text_area(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the text area input (see forms docs).
def text_area(**options, &block) options = decorate_options(**options) add_input(TextAreaInput.new(builder: builder, form: form, **options, &block)) end
def text_field(**options, &block)
-
block
(Proc
) -- A block that will be yielded a reference to the input object so it can be customized. -
options
(Hash
) -- The options accepted by the text field input (see forms docs).
def text_field(**options, &block) options = decorate_options(**options) add_input(TextFieldInput.new(builder: builder, form: form, **options, &block)) end