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 =
"space-y-8 divide-y divide-gray-200 sm:space-y-5"

Instance Method Summary collapse

Methods included from ClassNameHelper

#class_names

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
# 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: {}, **options, &block)
  options[:class] = class_names(DEFAULT_FORM_CLASSES, options[:class])
  options[:builder] ||= Ariadne::FormBuilder
  options[:html] ||= {}
  options = options.merge(attributes)
  data = {
    controller: "ariadne-form",
  }
  form_with(model: model, scope: scope, url: url, format: format, data: data, **options, &block)
end