Sha256: fc7747649cedff96ba9aa99697bf89c550fe5b3d39f35fb30f2f3a56ba392e5b
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
module TaoForm module Components module Select class ResultComponent < TaoForm::Components::FieldComponent attr_reader :choices, :field_options, :placeholder def initialize view, builder, attribute_name, choices = nil, options = {} super view, builder, attribute_name, options @choices = choices @placeholder = options.delete(:placeholder) init_field_options end def render &block if block_given? super elsif builder && attribute_name super { builder.select attribute_name, choices, field_options, {disabled: options[:disabled]} } end end def self.component_name :select_result end private def init_field_options @field_options = options.extract!( :selected, :include_blank, :prompt ) @field_options[:disabled] = options.delete(:option_disabled) if options.has_key?(:option_disabled) end def default_options {class: 'tao-select-result select-result'} end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tao_form-1.0.0.beta.2 | lib/tao_form/components/select/result_component.rb |
tao_form-1.0.0.beta.1 | lib/tao_form/components/select/result_component.rb |