Sha256: 94e0a4cd04dd4bfcc05003d8ca572e6fba729a023238df3883e331c73d876e5a

Contents?: true

Size: 603 Bytes

Versions: 5

Compression:

Stored size: 603 Bytes

Contents

module ActiveAdmin
  module Inputs
    class DatepickerInput < ::Formtastic::Inputs::StringInput
      def input_html_options
        super.tap do |options|
          options[:class] = [options[:class], "datepicker"].compact.join(' ')
          options[:data] ||= {}
          options[:data].merge! datepicker_options
        end
      end

      private
        def datepicker_options
          options = self.options.fetch(:datepicker_options, {})
          options = Hash[options.map{ |k, v| [k.to_s.camelcase(:lower), v] }]
          { :datepicker_options => options }
        end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yousty-activeadmin-1.0.4.pre lib/active_admin/inputs/datepicker_input.rb
yousty-activeadmin-1.0.3.pre lib/active_admin/inputs/datepicker_input.rb
yousty-activeadmin-1.0.2.pre lib/active_admin/inputs/datepicker_input.rb
yousty-activeadmin-1.0.1.pre lib/active_admin/inputs/datepicker_input.rb
yousty-activeadmin-1.0.0.pre lib/active_admin/inputs/datepicker_input.rb