Class: Playbook::PbForm::FormWith

Inherits:
KitBase
  • Object
show all
Defined in:
app/pb_kits/playbook/pb_form/form_with.rb

Defined Under Namespace

Classes: FormBuilder

Instance Method Summary collapse

Methods inherited from KitBase

#object

Methods included from ZIndex

included

Methods included from Spacing

included, #max_width_options, #max_width_props, #max_width_values, #spacing_options, #spacing_props, #spacing_values

Methods included from Classnames

#generate_classname, #generate_classname_without_spacing, included

Methods included from Playbook::Props

#initialize, #prop

Methods included from Playbook::PbKitHelper

#pb_rails

Instance Method Details

#classnameObject



32
33
34
# File 'app/pb_kits/playbook/pb_form/form_with.rb', line 32

def classname
  [generate_classname("pb-form"), options[:class]].join(" ")
end

#dataObject



13
14
15
# File 'app/pb_kits/playbook/pb_form/form_with.rb', line 13

def data
  prop(:data).merge("pb-form-validation" => validate)
end

#form_optionsObject



17
18
19
20
21
22
23
24
25
26
# File 'app/pb_kits/playbook/pb_form/form_with.rb', line 17

def form_options
  {
    url: "",
    id: id,
    aria: aria,
    class: classname,
    data: data,
    builder: ::Playbook::PbForm::FormWith::FormBuilder,
  }.merge(options)
end

#render_form(builder) ⇒ Object



28
29
30
# File 'app/pb_kits/playbook/pb_form/form_with.rb', line 28

def render_form(builder)
  view_context.capture(builder, &children)
end

#render_in(view_context, &_block) ⇒ Object



36
37
38
# File 'app/pb_kits/playbook/pb_form/form_with.rb', line 36

def render_in(view_context, &_block)
  super(view_context, &nil)
end