Sha256: 0ef87d6ca7f80dbf1e28811ecf646363282e44466be7e861f1c3cc3916ec8891

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 Bytes

Contents

module JqueryUiForm 
  module Inputs
    module SelectInput
      SELECT_OPTIONS = %w(selected include_blank disabled required)
      def select_input(method, options = {})
        basic_input_helper(:select, :select, method, options)   
      end
      
      def select(method, options = {})
        choices = options.delete(:collection)
        if options[:value]
          options[:selected] = options.delete(:value)
        end
        html_options = options.delete(:html) || {}
        options.each do |key,value|
          html_options[key] = options.delete(key) unless SELECT_OPTIONS.include?(key.to_s)
        end
        super(method, choices, options, html_options)
      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/select_input.rb
jquery-ui-form-0.2.7 lib/jquery_ui_form/inputs/select_input.rb
jquery-ui-form-0.2.6 lib/jquery_ui_form/inputs/select_input.rb