Module: ActiveScaffold::CalendarDateSelectBridge::FormColumnHelpers

Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb

Overview

Helpers that assist with the rendering of a Form Column

Instance Method Summary collapse

Instance Method Details

#active_scaffold_input_calendar_date_select(column, options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb', line 27

def active_scaffold_input_calendar_date_select(column, options)
  options[:class] = "#{options[:class]} text-input".strip
  if column.options.is_a?(Hash) && column.options[:update_column]
    options[:name].match(/record(\w+)\[/)
    scope = $1
    url_params = {:action => 'render_field'}
    url_params[:controller] = controller.class.active_scaffold_controller_for(@record.class).controller_path
    parameters = "column=#{column.name}"
    parameters << "&scope=#{scope}" if scope
    options[:onchange] = " new Ajax.Request(#{url_for(url_params).to_json}, {parameters: '#{parameters}&value=' + this.value, method: 'get'});"
  end
  calendar_date_select("record", column.name, options.merge(column.options))
end