Class: TaoForm::Components::FormComponent

Inherits:
TaoOnRails::Components::Base
  • Object
show all
Defined in:
lib/tao_form/components/form_component.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, record, options) ⇒ FormComponent

Returns a new instance of FormComponent.



7
8
9
10
11
12
# File 'lib/tao_form/components/form_component.rb', line 7

def initialize view, record, options
  super view, options
  @record = record
  @html_options = transform_html_options(@options.delete(:html) || {})
  @options[:wrapper] = :tao_mobile if view.request.variant.mobile?
end

Instance Attribute Details

#html_optionsObject (readonly)

Returns the value of attribute html_options.



5
6
7
# File 'lib/tao_form/components/form_component.rb', line 5

def html_options
  @html_options
end

#recordObject (readonly)

Returns the value of attribute record.



5
6
7
# File 'lib/tao_form/components/form_component.rb', line 5

def record
  @record
end

Class Method Details

.component_nameObject



18
19
20
# File 'lib/tao_form/components/form_component.rb', line 18

def self.component_name
  :form
end

Instance Method Details

#render(&block) ⇒ Object



14
15
16
# File 'lib/tao_form/components/form_component.rb', line 14

def render &block
  view. tag_name, view.simple_form_for(record, options, &block), html_options
end