Class: TaoForm::Components::RadioButtonComponent
- Inherits:
-
FieldComponent
- Object
- TaoOnRails::Components::Base
- FieldComponent
- TaoForm::Components::RadioButtonComponent
- Defined in:
- lib/tao_form/components/radio_button_component.rb
Instance Attribute Summary collapse
-
#checked ⇒ Object
readonly
Returns the value of attribute checked.
-
#checked_value ⇒ Object
readonly
Returns the value of attribute checked_value.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#field_options ⇒ Object
readonly
Returns the value of attribute field_options.
-
#unchecked_value ⇒ Object
readonly
Returns the value of attribute unchecked_value.
Attributes inherited from FieldComponent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, builder = nil, attribute_name = nil, options = {}) ⇒ RadioButtonComponent
constructor
A new instance of RadioButtonComponent.
- #render(&block) ⇒ Object
Constructor Details
#initialize(view, builder = nil, attribute_name = nil, options = {}) ⇒ RadioButtonComponent
Returns a new instance of RadioButtonComponent.
7 8 9 10 11 12 13 14 15 |
# File 'lib/tao_form/components/radio_button_component.rb', line 7 def initialize view, builder = nil, attribute_name = nil, = {} super view, builder, attribute_name, @checked_value = @options.delete(:checked_value) @unchecked_value = @options.delete(:unchecked_value) @checked = @options.delete(:checked) @disabled = @options.delete(:disabled) end |
Instance Attribute Details
#checked ⇒ Object (readonly)
Returns the value of attribute checked.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def checked @checked end |
#checked_value ⇒ Object (readonly)
Returns the value of attribute checked_value.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def checked_value @checked_value end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def disabled @disabled end |
#field_options ⇒ Object (readonly)
Returns the value of attribute field_options.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def @field_options end |
#unchecked_value ⇒ Object (readonly)
Returns the value of attribute unchecked_value.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def unchecked_value @unchecked_value end |
Class Method Details
.component_name ⇒ Object
17 18 19 |
# File 'lib/tao_form/components/radio_button_component.rb', line 17 def self.component_name :radio_button end |
Instance Method Details
#render(&block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tao_form/components/radio_button_component.rb', line 21 def render &block if block_given? super elsif builder && attribute_name super { builder. attribute_name, , checked_value, unchecked_value } else super { view. nil } end end |