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
# 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(default_html_options, @options.delete(:html) || {})
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



21
22
23
# File 'lib/tao_form/components/form_component.rb', line 21

def self.component_name
  :form
end

Instance Method Details

#render(&block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/tao_form/components/form_component.rb', line 13

def render &block
  if block_given?
    view. tag_name, view.simple_form_for(record, options, &block), html_options
  else
    super
  end
end