lib/trestle/form/fields/date_picker.rb in trestle-0.9.8 vs lib/trestle/form/fields/date_picker.rb in trestle-0.10.0.pre

- old
+ new

@@ -2,20 +2,26 @@ def normalize_options! unless options[:prepend] == false options[:prepend] ||= options.delete(:icon) { default_icon } end - if enable_date_picker? - options.reverse_merge!(data: { picker: true, allow_clear: true }) - end - super end + def defaults + defaults = super + defaults.merge!(data: { controller: controller, allow_clear: true }) if enable_date_picker? + defaults + end + def default_icon icon("fa fa-calendar") end def enable_date_picker? !disabled? && !readonly? && options[:picker] != false + end + + def controller + "datepicker" end end