File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed
lib/active_admin_datetimepicker Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change 11module ActiveAdminDatetimepicker
22 module Base
3- def html_class
4- 'date-time-picker'
3+ mattr_accessor :default_datetime_picker_options do
4+ { }
55 end
66
7- def format
7+ mattr_accessor : format do
88 '%Y-%m-%d %H:%M'
99 end
1010
11+ def html_class
12+ 'date-time-picker'
13+ end
14+
1115 def input_html_data
1216 { }
1317 end
@@ -33,8 +37,23 @@ def datetime_picker_options
3337 # backport support both :datepicker_options AND :datetime_picker_options
3438 options = self . options . fetch ( :datepicker_options , { } )
3539 options = self . options . fetch ( :datetime_picker_options , options )
36- Hash [ options . map { |k , v | [ k . to_s . camelcase ( :lower ) , v ] } ]
40+ options = Hash [ options . map { |k , v | [ k . to_s . camelcase ( :lower ) , v ] } ]
41+ _default_datetime_picker_options . merge ( options )
42+ end
43+ end
44+
45+ protected
46+
47+ def _default_datetime_picker_options
48+ res = default_datetime_picker_options . map do |k , v |
49+ if v . respond_to? ( :call ) || v . is_a? ( Proc )
50+ [ k , v . call ]
51+ else
52+ [ k , v ]
53+ end
3754 end
55+ Hash [ res ]
3856 end
3957 end
4058end
59+
You can’t perform that action at this time.
0 commit comments