Module: Ariadne::ActionViewExtensions::FormHelper
- Includes:
- ClassNameHelper
- Included in:
- Component
- Defined in:
- app/lib/ariadne/action_view_extensions/form_helper.rb
Overview
:nodoc:
Constant Summary collapse
- DEFAULT_FORM_CLASSES =
"ariadne-space-y-8 sm:ariadne-space-y-5"
Instance Method Summary collapse
Methods included from ClassNameHelper
Instance Method Details
#ariadne_form_with(model: nil, scope: nil, url: nil, format: nil, classes: "", attributes: {}, **options, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/lib/ariadne/action_view_extensions/form_helper.rb', line 10 def ariadne_form_with(model: nil, scope: nil, url: nil, format: nil, classes: "", attributes: {}, **, &block) [:class] = class_names(DEFAULT_FORM_CLASSES, [:class]) [:builder] ||= Ariadne::FormBuilder [:html] = attributes data_controller = [:html].fetch(:"data-controller", "") [:html][:"data-controller"] = if data_controller.present? "#{data_controller} ariadne-form" else "ariadne-form" end form_with(model: model, scope: scope, url: url, format: format, **, &block) end |