Sha256: 779e8fc18e21e74a331831e682f96400517239d7fcc7ce805836542730674bfc

Contents?: true

Size: 522 Bytes

Versions: 9

Compression:

Stored size: 522 Bytes

Contents

class DatePickerInput < SimpleForm::Inputs::Base
  
  def input(wrapper_options)
  
    if input_type == :date || input_type == :datetime || input_type == :time
      type = input_type
    else
      column = @builder.object.class.columns.select{ |c| c.name == attribute_name.to_s }.first
      type = column.present? ? column.type : nil
    end
    
    type||= :date

    opts = wrapper_options.merge(input_options.deep_dup)
    opts[:type] = type
    
    @builder.date_picker(attribute_name, opts)
    
  end
  
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
date_picker-0.0.9 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.8 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.7 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.6 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.5 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.4 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.3 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.2 test/dummy/app/inputs/date_picker_input.rb
date_picker-0.0.1 test/dummy/app/inputs/date_picker_input.rb