Module: ActiveScaffold::Bridges::DatePicker::Helper::SearchColumnHelpers

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

Instance Method Summary collapse

Instance Method Details

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



151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 151

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.search_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