Sha256: 2f1d65990772a8b2fccf859acfe99b34d4156384d0b9f97dc31dcc3b5f4e9fef

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

module TaoForm
  module Components
    class CheckBoxComponent < FieldComponent

      attr_reader :checked_value, :unchecked_value

      def initialize view, builder = nil, attribute_name = nil, options = {}, checked_value = '1', unchecked_value = '0'
        super view, builder, attribute_name, options
        @checked_value = checked_value
        @unchecked_value = unchecked_value
      end

      def self.component_name
        :check_box
      end

      def render &block
        if block_given?
          super
        else
          super {
            builder.check_box attribute_name, {}, checked_value, unchecked_value
          }
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tao_form-0.1.2 lib/tao_form/components/check_box_component.rb
tao_form-0.1.1 lib/tao_form/components/check_box_component.rb
tao_form-0.1.0 lib/tao_form/components/check_box_component.rb