Class: TaoForm::Components::Select::ResultComponent
- Inherits:
-
FieldComponent
- Object
- TaoOnRails::Components::Base
- FieldComponent
- TaoForm::Components::Select::ResultComponent
- Defined in:
- lib/tao_form/components/select/result_component.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
Attributes inherited from FieldComponent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, builder, attribute_name, choices = nil, options = {}, html_options) ⇒ ResultComponent
constructor
A new instance of ResultComponent.
- #render(&block) ⇒ Object
Constructor Details
#initialize(view, builder, attribute_name, choices = nil, options = {}, html_options) ⇒ ResultComponent
Returns a new instance of ResultComponent.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tao_form/components/select/result_component.rb', line 8 def initialize view, builder, attribute_name, choices = nil, = {}, super view, builder, attribute_name, @choices = choices @html_options = if @html_options[:class].present? @html_options[:class] += " select-result" else @html_options[:class] = "select-result" end end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
6 7 8 |
# File 'lib/tao_form/components/select/result_component.rb', line 6 def choices @choices end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
6 7 8 |
# File 'lib/tao_form/components/select/result_component.rb', line 6 def @html_options end |
Class Method Details
.component_name ⇒ Object
28 29 30 |
# File 'lib/tao_form/components/select/result_component.rb', line 28 def self.component_name :select_result end |
Instance Method Details
#render(&block) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/tao_form/components/select/result_component.rb', line 20 def render &block if block_given? super else super {builder.select attribute_name, choices, } end end |