Sha256: a88d799a439ccf9fa1c02f58024a399dcac8e88eb5a23c8e483a75d148f01eaf

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

module TaoForm
  module Components
    module Select
      class ResultComponent < TaoForm::Components::FieldComponent

        attr_reader :choices, :html_options

        def initialize view, builder, attribute_name, choices = nil, options = {}, html_options
          super view, builder, attribute_name, options
          @choices = choices
          @html_options = transform_html_options html_options

          if @html_options[:class].present?
            @html_options[:class] += " select-result"
          else
            @html_options[:class] = "select-result"
          end
        end

        def render &block
          if block_given?
            super
          else
            super {builder.select attribute_name, choices, options}
          end
        end

        def self.component_name
          :select_result
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tao_form-0.1.3 lib/tao_form/components/select/result_component.rb
tao_form-0.1.2 lib/tao_form/components/select/result_component.rb
tao_form-0.1.1 lib/tao_form/components/select/result_component.rb
tao_form-0.1.0 lib/tao_form/components/select/result_component.rb