Sha256: ea7e71a18b4e39daeea4e537e7b96e8225fa8de9d2e818cb6e297b0dfe2db935

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require 'simple_form'

module SimpleForm
  module Inputs

    class DatepickerInput < StringInput

      def input
        # Remove defaults that we do not want.
        html_classes.delete(:datepicker)
        html_classes.push(:datetimepicker)

        input_html_classes.push(:datetimepicker_date)
        input_html_options[:type] = "text"

        # Get the input in the correct format.
        input_html_options[:value] = object.send(attribute_name).try(:strftime, Time::DATE_FORMATS[:datetimepicker_date])
        @builder.text_field(attribute_name, input_html_options)
      end

    end
      
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datetimepicker-0.0.3 lib/datetimepicker/simple_form/inputs/datepicker_input.rb