Sha256: 2bd5350ef8a0c05737c9facedcc569de03864b605e53deeb5b97e25af8886e69

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

module JqueryUiForm 
  module Inputs
    module BooleanInput
      
      def boolean_input(method, options = {})
        basic_input_helper(:check_box, :boolean, method, options)   
      end
      
      def check_box(method, options = {})
        checked_value = options.delete(:checked_value) || "1"
        unchecked_value = options.delete(:unchecked_value) || "0"
        unless options[:value].nil?
          value = options.delete(:value)
          if value === true
            options[:checked] = true
          else
            options[:checked] ||= value.to_s == checked_value.to_s
          end
        end
        super(method, options,checked_value, unchecked_value)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jquery-ui-form-0.2.8 lib/jquery_ui_form/inputs/boolean_input.rb
jquery-ui-form-0.2.7 lib/jquery_ui_form/inputs/boolean_input.rb
jquery-ui-form-0.2.6 lib/jquery_ui_form/inputs/boolean_input.rb