Netzke::Basepack::SearchPanel

Public Instance Methods

normalize_field(f) click to toggle source

An override

    # File lib/netzke/basepack/search_panel.rb, line 9
 9:       def normalize_field(f)
10:         f = if f.is_a?(Symbol) || f.is_a?(String)
11:           {:name => f.to_s, :operator => default_operator}
12:         else
13:           search_condition = f[:name]
14:           if search_condition.is_a?(MetaWhere::Column)
15:             {:name => search_condition.column, :operator => search_condition.method}
16:           else
17:             {:name => search_condition.to_s}
18:           end
19:         end
20: 
21:         f = super(f)
22: 
23:         f[:disabled] = primary_key_attr?(f)
24: 
25:         # Association field
26:         if f[:name].to_s.index("__")
27:           f[:xtype] ||= xtype_for_attr_type(:string)
28:           f[:attr_type] = :string
29:         end
30: 
31:         f[:operator] ||= "gt" if [:datetime, :integer, :date].include?(f[:attr_type])
32:         f[:operator] ||= "eq" if f[:attr_type] == :boolean
33:         f[:operator] ||= default_operator
34: 
35:         f[:field_label] = [f[:field_label], f[:operator]].join(" ")
36:         f.merge(:name => [f[:name], f[:operator]].join("__"))
37:       end

Private Instance Methods

attr_type_to_xtype_map() click to toggle source
    # File lib/netzke/basepack/search_panel.rb, line 51
51:         def attr_type_to_xtype_map
52:           super.merge({
53:             :boolean => :tricheckbox
54:           })
55:         end
default_operator() click to toggle source
    # File lib/netzke/basepack/search_panel.rb, line 40
40:         def default_operator
41:           "like"
42:         end
get_combobox_options(params) click to toggle source

we need to correct the queries to cut off the condition suffixes, otherwise the FormPanel gets confused

    # File lib/netzke/basepack/search_panel.rb, line 45
45:         def get_combobox_options(params)
46:           column_name = params[:column]
47:           CONDITIONS.each { |c| column_name.sub!(/_#{c}$/, "") }
48:           super(:column => column_name)
49:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.