Module: ActiveScaffold::Bridges::CalendarDateSelect::SearchColumnHelpers

Defined in:
lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb

Instance Method Summary collapse

Instance Method Details

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



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb', line 26

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.column.type == :date ? :to_date : :to_time)
          else
            current_search
          end
  calendar_date_select(
    'record', column.name,
    :name => "#{options[:name]}[#{name}]",
    :value => (value ? l(value) : nil),
    :class => 'text-input',
    :id => "#{options[:id]}_#{name}",
    :time => column_datetime?(column) ? true : false,
    :style => ('display: none' if options[:show] == false) # hide only if asked to hide
  )
end