Class: Wice::FilterConditionsGeneratorCustomFilter
- Inherits:
-
FilterConditionsGenerator
- Object
- FilterConditionsGenerator
- Wice::FilterConditionsGeneratorCustomFilter
- Defined in:
- lib/filter_conditions_generators.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from FilterConditionsGenerator
Instance Method Summary collapse
-
#generate_conditions(opts) ⇒ Object
:nodoc:.
Methods inherited from FilterConditionsGenerator
Constructor Details
This class inherits a constructor from Wice::FilterConditionsGenerator
Instance Method Details
#generate_conditions(opts) ⇒ Object
:nodoc:
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/filter_conditions_generators.rb', line 20 def generate_conditions(opts) #:nodoc: return false # should be implemented # if opts.empty? # Wice.log "empty parameters for the grid custom filter" # return false # end # opts = (opts.kind_of?(Array) && opts.size == 1) ? opts[0] : opts # if opts.kind_of?(Array) # opts_with_special_values, normal_opts = opts.partition{|v| ::Wice::GridTools.special_value(v)} # conditions_ar = if normal_opts.size > 0 # [" #{@field.alias_or_table_name(table_alias)}.#{@field.name} IN ( " + (['?'] * normal_opts.size).join(', ') + ' )'] + normal_opts # else # [] # end # if opts_with_special_values.size > 0 # special_conditions = opts_with_special_values.collect{|v| " #{@field.alias_or_table_name(table_alias)}.#{@field.name} is " + v}.join(' or ') # if conditions_ar.size > 0 # conditions_ar[0] = " (#{conditions_ar[0]} or #{special_conditions} ) " # else # conditions_ar = " ( #{special_conditions} ) " # end # end # conditions_ar # else # if ::Wice::GridTools.special_value(opts) # " #{@field.alias_or_table_name(table_alias)}.#{@field.name} is " + opts # else # [" #{@field.alias_or_table_name(table_alias)}.#{@field.name} = ?", opts] # end # end end |