Module: ActiveScaffold::Bridges::DatePickerBridge::SearchColumnHelpers

Defined in:
lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb

Instance Method Summary collapse

Instance Method Details

#active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb', line 187

def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
  if current_search.is_a? Hash
    value = controller.class.condition_value_for_datetime(current_search[name], column.form_ui == :date_picker ? :to_date : :to_time)
  else
    value = current_search
  end
  options = column.options.merge(options).except!(:include_blank, :discard_time, :discard_date, :value)
  options = active_scaffold_input_text_options(options.merge(column.options))
  options[:class] << " #{column.search_ui.to_s}"
  options[:style] = "display:#{(options[:show].nil? || options[:show]) ? '' : 'none'}"
  format = options.delete(:format) || :default
  datepicker_format_options(column, format, options)
  text_field_tag("#{options[:name]}[#{name}]", value ? l(value, :format => format) : nil, options.merge(:id => "#{options[:id]}_#{name}", :name => "#{options[:name]}[#{name}]"))
end