Sha256: 4b9cae7703371e4d88548384a3198dbf7caeeadcfb4c246c50b5c7596b7ea032

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

module SimpleForm
  module Inputs
    class DateTimeInput < Base
      def input
        @builder.send(:"#{input_type}_select", attribute_name, input_options, input_html_options)
      end

      private

      def label_target
        position = case input_type
        when :date, :datetime
          date_order = input_options[:order] || I18n.t('date.order')
          date_order.first.to_sym
        else
          :hour
        end

        position = ActionView::Helpers::DateTimeSelector::POSITION[position]
        "#{attribute_name}_#{position}i"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_form-3.0.4 lib/simple_form/inputs/date_time_input.rb
simple_form-3.0.3 lib/simple_form/inputs/date_time_input.rb
simple_form-3.0.2 lib/simple_form/inputs/date_time_input.rb
simple_form-3.0.1 lib/simple_form/inputs/date_time_input.rb
simple_form-3.0.0 lib/simple_form/inputs/date_time_input.rb