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
165
166
167
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 151

def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
  value =
    if current_search.is_a? Hash
      controller.class.condition_value_for_datetime(column, current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
    else
      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))
  format = datepicker_format(options, column.search_ui)
  options[:class] << " #{column.search_ui}"
  options[:style] = 'display: none' if options[:show] == false # hide only if asked to hide
  options[:data] = datepicker_format_options(column, format).reverse_merge!(options[:data] || {})
  value = l(value, :format => format) if value
  options = options.merge(:id => "#{options[:id]}_#{name}", :name => "#{options[:name]}[#{name}]", :object => nil)
  text_field_tag("#{options[:name]}[#{name}]", value, options)
end