Class: Playbook::PbForm::SimpleForm

Inherits:
KitBase
  • Object
show all
Defined in:
app/pb_kits/playbook/pb_form/simple_form.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



43
44
45
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 43

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

#dataObject



39
40
41
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 39

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

#htmlObject



47
48
49
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 47

def html
  prop(:options).fetch(:html, {})
end

#modelObject



35
36
37
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 35

def model
  prop(:options).fetch(:model, nil)
end

#optionsObject



26
27
28
29
30
31
32
33
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 26

def options
  {
    builder: Playbook::PbForm::SimpleForm::FormBuilder,
    html: html_options,
    data: data,
    url: "",
  }.merge(prop(:options))
end

#render_in(view_context, &_block) ⇒ Object



51
52
53
# File 'app/pb_kits/playbook/pb_form/simple_form.rb', line 51

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