Sha256: 9069f040d451b6545d03c8ab497307065ea03536b61d8863111bfd43f7303ca8

Contents?: true

Size: 520 Bytes

Versions: 7

Compression:

Stored size: 520 Bytes

Contents

class DateTimeInput < 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

7 entries across 7 versions & 1 rubygems

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