3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/active_scaffold/bridges/date_picker/ext.rb', line 3
def initialize(model_id)
super
return unless ActiveScaffold::Bridges::DatePicker.default_ui
types = %i[date datetime timestamp timestamptz]
date_picker_fields = _columns.filter_map { |c| {name: c.name.to_sym, type: c.type} if types.include?(c.type) }
return if date_picker_fields.empty?
date_picker_fields.each do |field|
col_config = columns[field[:name]]
col_config.form_ui = (field[:type] == :date ? :date_picker : :datetime_picker)
end
end
|