Sha256: 3cd1bc242b4ef44e56ee05b409d0926eafe456d3f505e5b63c6d710a5957ce03

Contents?: true

Size: 925 Bytes

Versions: 5

Compression:

Stored size: 925 Bytes

Contents

module BootstrapForm
  module Datetimepicker
    def date_field(name, *args)
      options = args.extract_options!.symbolize_keys!
      options[:data] = {provide: 'datepicker', 'date-format' => 'L'}.merge(options[:data] || {})
      options[:append] = calendar_addon
      args << options
      super
    end

    def datetime_field(name, *args)
      options = args.extract_options!.symbolize_keys!
      options[:data] = {provide: 'datepicker'}.merge(options[:data] || {})
      options[:append] = calendar_addon
      args << options
      super
    end

    def datetime_local_field(name, *args)
      options = args.extract_options!.symbolize_keys!
      options[:data] = {provide: 'datepicker'}.merge(options[:data] || {})
      options[:append] = calendar_addon
      args << options
      super
    end

    private

      def calendar_addon
        content_tag('i', '', class: 'fa fa-calendar')
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
egov_utils-0.1.27 lib/bootstrap_form/datetimepicker.rb
egov_utils-0.1.26 lib/bootstrap_form/datetimepicker.rb
egov_utils-0.1.23 lib/bootstrap_form/datetimepicker.rb
egov_utils-0.1.19 lib/bootstrap_form/datetimepicker.rb
egov_utils-0.1.18 lib/bootstrap_form/datetimepicker.rb