lib/active_scaffold/helpers/search_column_helpers.rb
def active_scaffold_search_range(column, options, input_method = :text_field_tag, input_options = {})
        opt_value, from_value, to_value = field_search_params_range_values(column)

        select_options = active_scaffold_search_range_comparator_options(column)
        text_field_size = active_scaffold_search_range_string?(column) ? 15 : 10
        opt_value ||= select_options[0][1]

        from_value = controller.class.condition_value_for_numeric(column, from_value)
        to_value = controller.class.condition_value_for_numeric(column, to_value)
        from_value = format_number_value(from_value, column.options) if from_value.is_a?(Numeric)
        to_value = format_number_value(to_value, column.options) if to_value.is_a?(Numeric)
        html = select_tag("#{options[:name]}[opt]", options_for_select(select_options, opt_value),
                          :id => "#{options[:id]}_opt", :class => 'as_search_range_option')
        from_options = active_scaffold_input_text_options(input_options.merge(:id => options[:id], :size => text_field_size))
        to_options = from_options.merge(:id => "#{options[:id]}_to")
        html << content_tag('span', :id => "#{options[:id]}_numeric", :style => ActiveScaffold::Finder::NULL_COMPARATORS.include?(opt_value) ? 'display: none' : nil) do
          send(input_method, "#{options[:name]}[from]", from_value, input_options) <<
            content_tag(
              :span,
              safe_join([' - ', send(input_method, "#{options[:name]}[to]", to_value, to_options)]),
              :id => "#{options[:id]}_between", :class => 'as_search_range_between', :style => ('display: none' unless opt_value == 'BETWEEN')
            )
        end
        content_tag :span, html, :class => 'search_range'
      end
# This method decides which input to use for the given column.
# It does not do any rendering. It only decides which method is responsible for rendering.
This method decides which input to use for the given column.
It does not do any rendering. It only decides which method is responsible for rendering.
This method decides which input to use for the given column . It does not do any rendering . It only decides which method is responsible for rendering .
def active_scaffold_search_range(column, options, input_method = :text_field_tag, input_options = {})
        opt_value, from_value, to_value = field_search_params_range_values(column)
        select_options = active_scaffold_search_range_comparator_options(column)
        text_field_size = active_scaffold_search_range_string?(column) ? 15 : 10
        opt_value ||= select_options[0][1]
        from_value = controller.class.condition_value_for_numeric(column, from_value)
        to_value = controller.class.condition_value_for_numeric(column, to_value)
        from_value = format_number_value(from_value, column.options) if from_value.is_a?(Numeric)
        to_value = format_number_value(to_value, column.options) if to_value.is_a?(Numeric)
        html = select_tag("#{options[:name]}[opt]", options_for_select(select_options, opt_value),
                          :id => "#{options[:id]}_opt", :class => 'as_search_range_option')
        from_options = active_scaffold_input_text_options(input_options.merge(:id => options[:id], :size => text_field_size))
        to_options = from_options.merge(:id => "#{options[:id]}_to")
        html << content_tag('span', :id => "#{options[:id]}_numeric", :style => ActiveScaffold::Finder::NULL_COMPARATORS.include?(opt_value) ? 'display: none' : nil) do
          send(input_method, "#{options[:name]}[from]", from_value, input_options) <<
            content_tag(
              :span,
              safe_join([' - ', send(input_method, "#{options[:name]}[to]", to_value, to_options)]),
              :id => "#{options[:id]}_between", :class => 'as_search_range_between', :style => ('display: none' unless opt_value == 'BETWEEN')
            )
        end
        content_tag :span, html, :class => 'search_range'
      end
def active_scaffold_search_range ( column , options , input_method = :text_field_tag , input_options = { } ) opt_value , from_value , to_value = field_search_params_range_values ( column ) select_options = active_scaffold_search_range_comparator_options ( column ) text_field_size = active_scaffold_search_range_string? ( column ) ? 15 : 10 opt_value ||= select_options [ 0 ] [ 1 ] from_value = controller . class . condition_value_for_numeric ( column , from_value ) to_value = controller . class . condition_value_for_numeric ( column , to_value ) from_value = format_number_value ( from_value , column . options ) if from_value . is_a? ( Numeric ) to_value = format_number_value ( to_value , column . options ) if to_value . is_a? ( Numeric ) html = select_tag ( "#{options[:name]}[opt]" , options_for_select ( select_options , opt_value ) , :id => "#{options[:id]}_opt" , :class => 'as_search_range_option' ) from_options = active_scaffold_input_text_options ( input_options . merge ( :id => options [ :id ] , :size => text_field_size ) ) to_options = from_options . merge ( :id => "#{options[:id]}_to" ) html << content_tag ( 'span' , :id => "#{options[:id]}_numeric" , :style => ActiveScaffold :: Finder :: NULL_COMPARATORS . include? ( opt_value ) ? 'display: none' : nil ) do send ( input_method , "#{options[:name]}[from]" , from_value , input_options ) << content_tag ( :span , safe_join ( [ ' - ' , send ( input_method , "#{options[:name]}[to]" , to_value , to_options ) ] ) , :id => "#{options[:id]}_between" , :class => 'as_search_range_between' , :style => ( 'display: none' unless opt_value == 'BETWEEN' ) ) end content_tag :span , html , :class => 'search_range' end
This method decides which input to use for the given column.
This method decides which input to use for the given column .
column
options
input_method
input_options