Module: ActiveScaffold::CalendarDateSelectBridge::SearchColumnHelpers

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

Instance Method Summary collapse

Instance Method Details

#active_scaffold_search_calendar_date_select(column, options) ⇒ Object

AST



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/bridges/calendar_date_select/lib/as_cds_bridge.rb', line 55

def active_scaffold_search_calendar_date_select(column, options)
      opt_value, from_value, to_value = search_session_column_range_values(column)
      id_name = options[:id]
      html = []
      html << select_tag("#{options[:name]}[opt]",
            options_for_select(ActiveScaffold::Finder::NumericComparators.collect {|comp| [as_(comp.titleize), comp]}, opt_value),
            :id => "#{id_name}_opt",
            :onchange => "Element[this.value == 'BETWEEN' ? 'show' : 'hide']('#{id_name}_between');")
      options = {:name => "#{options[:name]}[from]", :help_string => "", :class => "range-input"}.merge(active_scaffold_input_text_options(:id => "#{id_name}_from", :size => 10))
      options[:value] = nil
      options[:value] = from_value
      html << active_scaffold_input_calendar_date_select(column, options)
      options[:value] = nil
      options[:value] = to_value
      options[:name].gsub!('[from]', '[to]')
      options[:id].gsub!('_from', '_to')
      html << (:span, ' - ' + active_scaffold_input_calendar_date_select(column, options),
                        :id => "#{id_name}_between", :style => to_value.blank? ? "display:none" : "")
      html * ' '
end