wice_grid 3.0.4 → 3.2.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/CHANGELOG +24 -2
  2. data/README.rdoc +282 -316
  3. data/RELEASE_NOTES_3.2.pre1.rdoc +82 -0
  4. data/Rakefile +4 -2
  5. data/SAVED_QUERIES_HOWTO.rdoc +18 -31
  6. data/VERSION +1 -1
  7. data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +22 -0
  8. data/lib/generators/wice_grid/install_generator.rb +20 -0
  9. data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +13 -0
  10. data/lib/generators/wice_grid/templates/wice_grid.css.scss +139 -0
  11. data/lib/generators/wice_grid/templates/wice_grid.yml +113 -19
  12. data/lib/generators/wice_grid/templates/wice_grid_config.rb +17 -41
  13. data/lib/grid_output_buffer.rb +3 -2
  14. data/lib/grid_renderer.rb +63 -102
  15. data/lib/helpers/js_calendar_helpers.rb +27 -157
  16. data/lib/helpers/wice_grid_misc_view_helpers.rb +1 -66
  17. data/lib/helpers/wice_grid_serialized_queries_view_helpers.rb +41 -32
  18. data/lib/helpers/wice_grid_view_helpers.rb +138 -274
  19. data/lib/table_column_matrix.rb +11 -11
  20. data/lib/view_columns.rb +41 -350
  21. data/lib/view_columns/action_view_column.rb +45 -0
  22. data/lib/view_columns/column_processor_index.rb +16 -0
  23. data/lib/view_columns/view_column_boolean.rb +23 -0
  24. data/lib/view_columns/view_column_custom_dropdown.rb +81 -0
  25. data/lib/view_columns/view_column_date.rb +17 -0
  26. data/lib/view_columns/view_column_datetime.rb +85 -0
  27. data/lib/view_columns/view_column_float.rb +7 -0
  28. data/lib/view_columns/view_column_integer.rb +38 -0
  29. data/lib/view_columns/view_column_string.rb +63 -0
  30. data/lib/wice_grid.rb +23 -26
  31. data/lib/wice_grid_controller.rb +14 -15
  32. data/lib/wice_grid_misc.rb +3 -3
  33. data/lib/wice_grid_serialized_queries_controller.rb +15 -18
  34. data/lib/wice_grid_spreadsheet.rb +2 -2
  35. data/lib/will_paginate_paginator.rb +31 -0
  36. data/test/readme.txt +1 -0
  37. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/arrow_down.gif +0 -0
  38. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/arrow_up.gif +0 -0
  39. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/calendar_view_month.png +0 -0
  40. data/vendor/assets/images/icons/grid/collapse.gif +0 -0
  41. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/delete.png +0 -0
  42. data/vendor/assets/images/icons/grid/expand.gif +0 -0
  43. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/page_white_excel.png +0 -0
  44. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/page_white_find.png +0 -0
  45. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/table.png +0 -0
  46. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/table_refresh.png +0 -0
  47. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/tick_all.png +0 -0
  48. data/{lib/generators/wice_grid/templates/icons → vendor/assets/images/icons/grid}/untick_all.png +0 -0
  49. data/vendor/assets/javascripts/wice_grid.js +3 -0
  50. data/vendor/assets/javascripts/wice_grid_init.js.coffee +247 -0
  51. data/vendor/assets/javascripts/wice_grid_processor.js.coffee +128 -0
  52. data/vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee +103 -0
  53. data/wice_grid.gemspec +44 -50
  54. metadata +68 -94
  55. data/lib/generators/wice_grid/templates/calendarview.css +0 -107
  56. data/lib/generators/wice_grid/templates/calendarview.js +0 -1168
  57. data/lib/generators/wice_grid/templates/icons/expand.png +0 -0
  58. data/lib/generators/wice_grid/templates/wice_grid.css +0 -173
  59. data/lib/generators/wice_grid/templates/wice_grid_jquery.js +0 -162
  60. data/lib/generators/wice_grid/templates/wice_grid_prototype.js +0 -154
  61. data/lib/generators/wice_grid/wice_grid_assets_jquery_generator.rb +0 -32
  62. data/lib/generators/wice_grid/wice_grid_assets_prototype_generator.rb +0 -34
  63. data/lib/js_adaptors/jquery_adaptor.rb +0 -157
  64. data/lib/js_adaptors/js_adaptor.rb +0 -12
  65. data/lib/js_adaptors/prototype_adaptor.rb +0 -179
  66. data/lib/tasks/wice_grid_tasks.rake +0 -28
  67. data/lib/views/create.rjs +0 -13
  68. data/lib/views/create_jq.rjs +0 -31
  69. data/lib/views/delete.rjs +0 -12
  70. data/lib/views/delete_jq.rjs +0 -26
  71. data/test/.gitignore +0 -2
  72. data/test/database.yml +0 -21
  73. data/test/schema.rb +0 -33
  74. data/test/test_helper.rb +0 -89
  75. data/test/views/projects_and_people_grid.html.erb +0 -12
  76. data/test/views/projects_and_people_grid_invalid.html.erb +0 -12
  77. data/test/views/simple_projects_grid.html.erb +0 -9
  78. data/test/wice_grid_core_ext_test.rb +0 -183
  79. data/test/wice_grid_functional_test.rb +0 -68
  80. data/test/wice_grid_misc_test.rb +0 -41
  81. data/test/wice_grid_test.rb +0 -42
  82. data/test/wice_grid_view_helper_test.rb +0 -12
@@ -0,0 +1,45 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ActionViewColumn < ViewColumn #:nodoc:
5
+ def initialize(grid_obj, html, param_name, select_all_buttons, object_property, view) #:nodoc:
6
+ @view = view
7
+ @select_all_buttons = select_all_buttons
8
+ self.grid = grid_obj
9
+ self.html = html
10
+ self.html.add_or_append_class_value!('sel')
11
+ grid_name = self.grid.name
12
+ @param_name = param_name
13
+ @cell_rendering_block = lambda do |object, params|
14
+ selected = if params[grid_name] && params[grid_name][param_name] &&
15
+ params[grid_name][param_name].index(object.send(object_property).to_s)
16
+ true
17
+ else
18
+ false
19
+ end
20
+ check_box_tag("#{grid_name}[#{param_name}][]", object.send(object_property), selected, :id => nil)
21
+ end
22
+ end
23
+
24
+ def in_html #:nodoc:
25
+ true
26
+ end
27
+
28
+ def capable_of_hosting_filter_related_icons? #:nodoc:
29
+ false
30
+ end
31
+
32
+ def name #:nodoc:
33
+ return '' unless @select_all_buttons
34
+
35
+ content_tag(:div, '',
36
+ :class => 'clickable select-all',
37
+ :title => NlMessage['select_all']) + ' ' +
38
+ content_tag(:div, '',
39
+ :class => 'clickable deselect-all',
40
+ :title => NlMessage['deselect_all'])
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+ COLUMN_PROCESSOR_INDEX = {
4
+ :action => 'action_view_column', # Special processor for action column, columns with checkboxes
5
+ :text => 'view_column_string',
6
+ :string => 'view_column_string',
7
+ :timestamp => 'view_column_datetime',
8
+ :datetime => 'view_column_datetime',
9
+ :date => 'view_column_date',
10
+ :integer => 'view_column_integer',
11
+ :float => 'view_column_float',
12
+ :decimal => 'view_column_float',
13
+ :custom => 'view_column_custom_dropdown', # Special processor for custom filter columns
14
+ :boolean => 'view_column_boolean'
15
+ }
16
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+
5
+ class ViewColumnBoolean < ViewColumnCustomDropdown #:nodoc:
6
+ include ActionView::Helpers::FormOptionsHelper
7
+
8
+ attr_accessor :boolean_filter_true_label, :boolean_filter_false_label
9
+
10
+ def render_filter_internal(params) #:nodoc:
11
+ @custom_filter = {
12
+ @filter_all_label => nil,
13
+ @boolean_filter_true_label => 't',
14
+ @boolean_filter_false_label => 'f'
15
+ }
16
+
17
+ @turn_off_select_toggling = true
18
+ super(params)
19
+ end
20
+ end
21
+
22
+
23
+ end
@@ -0,0 +1,81 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+
5
+ class ViewColumnCustomDropdown < ViewColumn #:nodoc:
6
+ include ActionView::Helpers::FormOptionsHelper
7
+
8
+ attr_accessor :filter_all_label
9
+ attr_accessor :custom_filter
10
+
11
+ def render_filter_internal(params) #:nodoc:
12
+ @query, @query_without_equals_sign, @parameter_name, @dom_id = form_parameter_name_id_and_query('')
13
+ @query_without_equals_sign += '%5B%5D='
14
+
15
+ @custom_filter = @custom_filter.call if @custom_filter.kind_of? Proc
16
+
17
+ if @custom_filter.kind_of? Array
18
+
19
+ @custom_filter = [[@filter_all_label, nil]] + @custom_filter.map{|label, value|
20
+ [label.to_s, value.to_s]
21
+ }
22
+
23
+ end
24
+
25
+ select_options = {:name => @parameter_name + '[]', :id => @dom_id, :class => 'custom-dropdown'}
26
+
27
+ if @turn_off_select_toggling
28
+ select_toggle = ''
29
+ else
30
+ if self.allow_multiple_selection
31
+ select_options[:multiple] = params.is_a?(Array) && params.size > 1
32
+
33
+ expand_icon_style, collapse_icon_style = nil, 'display: none'
34
+ expand_icon_style, collapse_icon_style = collapse_icon_style, expand_icon_style if select_options[:multiple]
35
+
36
+ select_toggle = content_tag(:span, '',
37
+ :title => NlMessage['expand'],
38
+ :class => 'expand-multi-select-icon clickable',
39
+ :style => expand_icon_style
40
+ ) +
41
+ content_tag(:span, '',
42
+ :title => NlMessage['collapse'],
43
+ :class => 'collapse-multi-select-icon clickable',
44
+ :style => collapse_icon_style
45
+ )
46
+ else
47
+ select_options[:multiple] = false
48
+ select_toggle = ''
49
+ end
50
+ end
51
+
52
+ if auto_reload
53
+ select_options[:class] += ' auto-reload'
54
+ end
55
+
56
+ params_for_select = (params.is_a?(Hash) && params.empty?) ? [nil] : params
57
+
58
+ '<div class="custom-dropdown-container">'.html_safe_if_necessary +
59
+ content_tag(:select,
60
+ options_for_select(@custom_filter, params_for_select),
61
+ select_options) +
62
+ select_toggle.html_safe_if_necessary + '</div>'.html_safe_if_necessary
63
+ end
64
+
65
+
66
+ def yield_declaration_of_column_filter #:nodoc:
67
+ {
68
+ :templates => [@query_without_equals_sign],
69
+ :ids => [@dom_id]
70
+ }
71
+ end
72
+
73
+
74
+ def has_auto_reloading_select? #:nodoc:
75
+ auto_reload
76
+ end
77
+ end
78
+
79
+
80
+
81
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ViewColumnDate < ViewColumnDatetime #:nodoc:
5
+
6
+ @@datetime_chunk_names = %w(year month day)
7
+
8
+ def render_standard_filter_internal(params) #:nodoc:
9
+ '<div class="date-filter">' +
10
+ select_date(params[:fr], {:include_blank => true, :prefix => @name1, :id => @dom_id}) + '<br/>' +
11
+ select_date(params[:to], {:include_blank => true, :prefix => @name2, :id => @dom_id2}) +
12
+ '</div>'
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,85 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ViewColumnDatetime < ViewColumn #:nodoc:
5
+ include ActionView::Helpers::DateHelper
6
+ include Wice::JsCalendarHelpers
7
+
8
+
9
+ # name_and_id_from_options in Rails Date helper does not substitute '.' with '_'
10
+ # like all other simpler form helpers do. Thus, overriding it here.
11
+ def name_and_id_from_options(options, type) #:nodoc:
12
+ options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : "[#{type}]")
13
+ options[:id] = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
14
+ end
15
+
16
+ @@datetime_chunk_names = %w(year month day hour minute)
17
+
18
+ def prepare_for_standard_filter #:nodoc:
19
+ x = lambda{|sym|
20
+ @@datetime_chunk_names.collect{|datetime_chunk_name|
21
+ triple = form_parameter_name_id_and_query(sym => {datetime_chunk_name => ''})
22
+ [triple[0], triple[3]]
23
+ }
24
+ }
25
+
26
+ @queris_ids = x.call(:fr) + x.call(:to)
27
+
28
+ _, _, @name1, _ = form_parameter_name_id_and_query({:fr => ''})
29
+ _, _, @name2, _ = form_parameter_name_id_and_query({:to => ''})
30
+ end
31
+
32
+
33
+ def prepare_for_calendar_filter #:nodoc:
34
+ query, _, @name1, @dom_id = form_parameter_name_id_and_query(:fr => '')
35
+ query2, _, @name2, @dom_id2 = form_parameter_name_id_and_query(:to => '')
36
+
37
+ @queris_ids = [[query, @dom_id], [query2, @dom_id2] ]
38
+ end
39
+
40
+
41
+ def render_standard_filter_internal(params) #:nodoc:
42
+ '<div class="date-filter">' +
43
+ select_datetime(params[:fr], {:include_blank => true, :prefix => @name1}) + '<br/>' +
44
+ select_datetime(params[:to], {:include_blank => true, :prefix => @name2}) +
45
+ '</div>'
46
+ end
47
+
48
+ def render_calendar_filter_internal(params) #:nodoc:
49
+
50
+ html1 = date_calendar_jquery(
51
+ params[:fr], NlMessage['date_selector_tooltip_from'], :prefix => @name1, :fire_event => auto_reload, :grid_name => self.grid.name)
52
+
53
+ html2 = date_calendar_jquery(
54
+ params[:to], NlMessage['date_selector_tooltip_to'], :prefix => @name2, :fire_event => auto_reload, :grid_name => self.grid.name)
55
+
56
+ %!<div class="date-filter">#{html1}<br/>#{html2}</div>!
57
+ end
58
+
59
+
60
+ def render_filter_internal(params) #:nodoc:
61
+ if helper_style == :standard
62
+ prepare_for_standard_filter
63
+ render_standard_filter_internal(params)
64
+ else
65
+ prepare_for_calendar_filter
66
+ render_calendar_filter_internal(params)
67
+ end
68
+ end
69
+
70
+
71
+ def yield_declaration_of_column_filter #:nodoc:
72
+ {
73
+ :templates => @queris_ids.collect{|tuple| tuple[0] },
74
+ :ids => @queris_ids.collect{|tuple| tuple[1] }
75
+ }
76
+ end
77
+
78
+
79
+ def has_auto_reloading_calendar? #:nodoc:
80
+ auto_reload && helper_style == :calendar
81
+ end
82
+
83
+ end
84
+
85
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ViewColumnFloat < ViewColumnInteger #:nodoc:
5
+ end
6
+
7
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ViewColumnInteger < ViewColumn #:nodoc:
5
+
6
+ def render_filter_internal(params) #:nodoc:
7
+ @contains_a_text_input = true
8
+
9
+ @query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(:fr => '')
10
+ @query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(:to => '')
11
+
12
+ opts1 = {:size => 3, :id => @dom_id, :class => 'range-start'}
13
+ opts2 = {:size => 3, :id => @dom_id2, :class => 'range-end'}
14
+
15
+ if auto_reload
16
+ opts1[:class] += ' auto-reload'
17
+ opts2[:class] += ' auto-reload'
18
+ end
19
+
20
+ text_field_tag(parameter_name, params[:fr], opts1) + text_field_tag(parameter_name2, params[:to], opts2)
21
+ end
22
+
23
+ def yield_declaration_of_column_filter #:nodoc:
24
+ {
25
+ :templates => [@query, @query2],
26
+ :ids => [@dom_id, @dom_id2]
27
+ }
28
+ end
29
+
30
+
31
+ def has_auto_reloading_input? #:nodoc:
32
+ auto_reload
33
+ end
34
+
35
+ end
36
+
37
+
38
+ end
@@ -0,0 +1,63 @@
1
+ # encoding: UTF-8
2
+ module Wice
3
+
4
+ class ViewColumnString < ViewColumn #:nodoc:
5
+
6
+ attr_accessor :negation, :auto_reloading_input_with_negation_checkbox
7
+
8
+ def render_filter_internal(params) #:nodoc:
9
+ @contains_a_text_input = true
10
+ css_class = auto_reload ? 'auto-reload' : nil
11
+
12
+ if negation
13
+ self.auto_reloading_input_with_negation_checkbox = true if auto_reload
14
+
15
+ @query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(:v => '')
16
+ @query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(:n => '')
17
+
18
+ '<div class="text-filter-container">' +
19
+ text_field_tag(parameter_name, params[:v], :size => 8, :id => @dom_id, :class => css_class) +
20
+ if defined?(Wice::Defaults::NEGATION_CHECKBOX_LABEL) && ! Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL).blank?
21
+ Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL)
22
+ else
23
+ ''
24
+ end +
25
+ check_box_tag(parameter_name2, '1', (params[:n] == '1'),
26
+ :id => @dom_id2,
27
+ :title => NlMessage['negation_checkbox_title'],
28
+ :class => "negation-checkbox #{css_class}") +
29
+ '</div>'
30
+ else
31
+ @query, _, parameter_name, @dom_id = form_parameter_name_id_and_query('')
32
+ text_field_tag(parameter_name, (params.blank? ? '' : params), :size => 8, :id => @dom_id, :class => css_class)
33
+ end
34
+ end
35
+
36
+
37
+ def yield_declaration_of_column_filter #:nodoc:
38
+ if negation
39
+ {
40
+ :templates => [@query, @query2],
41
+ :ids => [@dom_id, @dom_id2]
42
+ }
43
+ else
44
+ {
45
+ :templates => [@query],
46
+ :ids => [@dom_id]
47
+ }
48
+ end
49
+ end
50
+
51
+
52
+ def has_auto_reloading_input? #:nodoc:
53
+ auto_reload
54
+ end
55
+
56
+ def auto_reloading_input_with_negation_checkbox? #:nodoc:
57
+ self.auto_reloading_input_with_negation_checkbox
58
+ end
59
+
60
+ end
61
+
62
+
63
+ end
data/lib/wice_grid.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+
2
3
  require 'will_paginate.rb'
3
4
  require 'wice_grid_misc.rb'
4
5
  require 'wice_grid_core_ext.rb'
@@ -13,9 +14,7 @@ require 'grid_output_buffer.rb'
13
14
  require 'wice_grid_controller.rb'
14
15
  require 'wice_grid_spreadsheet.rb'
15
16
  require 'wice_grid_serialized_queries_controller.rb'
16
- require 'js_adaptors/js_adaptor.rb'
17
- require 'js_adaptors/jquery_adaptor.rb'
18
- require 'js_adaptors/prototype_adaptor.rb'
17
+ require 'view_columns/column_processor_index.rb'
19
18
  require 'view_columns.rb'
20
19
 
21
20
 
@@ -24,7 +23,7 @@ ActionController::Base.send(:helper_method, :wice_grid_custom_filter_params)
24
23
 
25
24
  module Wice
26
25
 
27
- class WiceGridRailtie < Rails::Railtie #:nodoc:
26
+ class WiceGridEngine < ::Rails::Engine
28
27
 
29
28
  initializer "wice_grid_railtie.configure_rails_initialization" do |app|
30
29
 
@@ -45,23 +44,22 @@ module Wice
45
44
  ActionView::Helpers::FormTagHelper].each do |m|
46
45
  JsCalendarHelpers.send(:include, m)
47
46
  end
48
- end
49
47
 
50
- ActiveSupport.on_load :action_view do
51
48
  Wice::GridRenderer.send(:include, ::WillPaginate::ViewHelpers)
49
+ ViewColumn.load_column_processors
52
50
  require 'wice_grid_serialized_query.rb'
53
51
  end
54
- end
55
52
 
56
- rake_tasks do
57
- load 'tasks/wice_grid_tasks.rake'
53
+ require 'will_paginate_paginator.rb'
54
+
58
55
  end
56
+
59
57
  end
60
58
 
61
59
  class WiceGrid
62
60
 
63
61
  attr_reader :klass, :name, :resultset, :custom_order, :query_store_model
64
- attr_reader :ar_options, :status, :export_to_csv_enabled, :csv_file_name, :saved_query
62
+ attr_reader :ar_options, :status, :export_to_csv_enabled, :csv_file_name, :csv_field_separator, :saved_query
65
63
  attr_writer :renderer
66
64
  attr_accessor :output_buffer, :view_helper_finished, :csv_tempfile
67
65
 
@@ -100,6 +98,7 @@ module Wice
100
98
  @options = {
101
99
  :conditions => nil,
102
100
  :csv_file_name => nil,
101
+ :csv_field_separator => Defaults::CSV_FIELD_SEPARATOR,
103
102
  :custom_order => {},
104
103
  :enable_export_to_csv => Defaults::ENABLE_EXPORT_TO_CSV,
105
104
  :group => nil,
@@ -123,6 +122,7 @@ module Wice
123
122
  @options.merge!(opts)
124
123
  @export_to_csv_enabled = @options[:enable_export_to_csv]
125
124
  @csv_file_name = @options[:csv_file_name]
125
+ @csv_field_separator = @options[:csv_field_separator]
126
126
 
127
127
  case @name = @options[:name]
128
128
  when String
@@ -207,18 +207,18 @@ module Wice
207
207
  end
208
208
  end
209
209
 
210
- def declare_column(column_name, model_class, custom_filter_active, table_alias) #:nodoc:
211
- if model_class # this is an included table
212
- column = @table_column_matrix.get_column_by_model_class_and_column_name(model_class, column_name)
213
- raise WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{model_class.table_name}'!") if column.nil?
210
+ def declare_column(column_name, model, custom_filter_active, table_alias) #:nodoc:
211
+ if model # this is an included table
212
+ column = @table_column_matrix.get_column_by_model_class_and_column_name(model, column_name)
213
+ raise WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{model.table_name}'!") if column.nil?
214
214
  main_table = false
215
- table_name = model_class.table_name
215
+ table_name = model.table_name
216
216
  else
217
217
  column = @table_column_matrix.get_column_in_default_model_class_by_column_name(column_name)
218
218
  if column.nil?
219
219
  raise WiceGridArgumentError.new("Column '#{column_name}' is not found in table '#{@klass.table_name}'! " +
220
220
  "If '#{column_name}' belongs to another table you should declare it in :include or :join when initialising " +
221
- "the grid, and specify :model_class in column declaration.")
221
+ "the grid, and specify :model in column declaration.")
222
222
  end
223
223
  main_table = true
224
224
  table_name = @table_column_matrix.default_model_class.table_name
@@ -325,9 +325,9 @@ module Wice
325
325
  def ordered_by?(column) #:nodoc:
326
326
  return nil if @status[:order].blank?
327
327
  if column.main_table && ! offs = @status[:order].index('.')
328
- @status[:order] == column.attribute_name
328
+ @status[:order] == column.attribute
329
329
  else
330
- @status[:order] == column.table_alias_or_table_name + '.' + column.attribute_name
330
+ @status[:order] == column.table_alias_or_table_name + '.' + column.attribute
331
331
  end
332
332
  end
333
333
 
@@ -393,7 +393,7 @@ module Wice
393
393
 
394
394
  # with this variant we get even those values which do not appear in the resultset
395
395
  def distinct_values_for_column(column) #:nodoc:
396
- res = column.model_klass.find(:all, :select => "distinct #{column.name}", :order => "#{column.name} asc").collect{|ar|
396
+ res = column.model.find(:all, :select => "distinct #{column.name}", :order => "#{column.name} asc").collect{|ar|
397
397
  ar[column.name]
398
398
  }.reject{|e| e.blank?}.map{|i|[i,i]}
399
399
  end
@@ -599,10 +599,10 @@ module Wice
599
599
  # to be mixed in into ActiveRecord::ConnectionAdapters::Column
600
600
  module WiceGridExtentionToActiveRecordColumn #:nodoc:
601
601
 
602
- attr_accessor :model_klass
602
+ attr_accessor :model
603
603
 
604
604
  def alias_or_table_name(table_alias)
605
- table_alias || self.model_klass.table_name
605
+ table_alias || self.model.table_name
606
606
  end
607
607
 
608
608
  def wg_initialize_request_parameters(all_filter_params, main_table, table_alias, custom_filter_active) #:nodoc:
@@ -686,8 +686,7 @@ module Wice
686
686
  class FilterConditionsGeneratorCustomFilter < FilterConditionsGenerator #:nodoc:
687
687
 
688
688
  def generate_conditions(table_alias, opts) #:nodoc:
689
- if opts.empty?
690
- Wice.log "empty parameters for the grid custom filter"
689
+ if opts.empty? || (opts.is_a?(Array) && opts.size == 1 && opts[0].blank?)
691
690
  return false
692
691
  end
693
692
  opts = (opts.kind_of?(Array) && opts.size == 1) ? opts[0] : opts
@@ -756,10 +755,9 @@ module Wice
756
755
  return false
757
756
  end
758
757
  if string_fragment.empty?
759
- Wice.log "invalid parameters for the grid string filter - empty string"
760
758
  return false
761
759
  end
762
- [" #{negation} #{@column.alias_or_table_name(table_alias)}.#{@column.name} #{::Wice.get_string_matching_operators(@column.model_klass)} ?",
760
+ [" #{negation} #{@column.alias_or_table_name(table_alias)}.#{@column.name} #{::Wice.get_string_matching_operators(@column.model)} ?",
763
761
  '%' + string_fragment + '%']
764
762
  end
765
763
 
@@ -795,7 +793,6 @@ module Wice
795
793
  end
796
794
 
797
795
  if conditions.size == 1
798
- Wice.log "invalid parameters for the grid integer filter - either range limits are not supplied or they are not numeric"
799
796
  return false
800
797
  end
801
798