lib/active_admin/inputs/datepicker_input.rb in activeadmin-0.6.6 vs lib/active_admin/inputs/datepicker_input.rb in activeadmin-1.0.0.pre1

- old
+ new

@@ -1,11 +1,20 @@ module ActiveAdmin module Inputs class DatepickerInput < ::Formtastic::Inputs::StringInput def input_html_options - options = super - options[:class] = [options[:class], "datepicker"].compact.join(' ') - 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