wice_grid_ms 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.inch.yml +3 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +181 -0
  6. data/.travis.yml +22 -0
  7. data/CHANGELOG.md +714 -0
  8. data/Gemfile +4 -0
  9. data/MIT-LICENSE +20 -0
  10. data/README.md +1518 -0
  11. data/Rakefile +59 -0
  12. data/SAVED_QUERIES_HOWTO.md +113 -0
  13. data/TODO.md +16 -0
  14. data/app/views/kaminari/wice_grid/_gap.html.erb +1 -0
  15. data/app/views/kaminari/wice_grid/_next_page.html.erb +1 -0
  16. data/app/views/kaminari/wice_grid/_page.html.erb +1 -0
  17. data/app/views/kaminari/wice_grid/_paginator.html.erb +19 -0
  18. data/app/views/kaminari/wice_grid/_prev_page.html.erb +1 -0
  19. data/config/locales/cz.yml +45 -0
  20. data/config/locales/de.yml +47 -0
  21. data/config/locales/en.yml +47 -0
  22. data/config/locales/es.yml +47 -0
  23. data/config/locales/fr.yml +45 -0
  24. data/config/locales/is.yml +46 -0
  25. data/config/locales/it.yml +38 -0
  26. data/config/locales/ja.yml +47 -0
  27. data/config/locales/nl.yml +45 -0
  28. data/config/locales/pt-BR.yml +36 -0
  29. data/config/locales/pt.yml +45 -0
  30. data/config/locales/ru.yml +45 -0
  31. data/config/locales/sk.yml +45 -0
  32. data/config/locales/uk.yml +45 -0
  33. data/config/locales/zh.yml +45 -0
  34. data/lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb +20 -0
  35. data/lib/generators/wice_grid/install_generator.rb +14 -0
  36. data/lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb +14 -0
  37. data/lib/generators/wice_grid/templates/wice_grid_config.rb +192 -0
  38. data/lib/wice/active_record_column_wrapper.rb +123 -0
  39. data/lib/wice/columns.rb +276 -0
  40. data/lib/wice/columns/column_action.rb +52 -0
  41. data/lib/wice/columns/column_boolean.rb +40 -0
  42. data/lib/wice/columns/column_bootstrap_datepicker.rb +48 -0
  43. data/lib/wice/columns/column_custom_dropdown.rb +115 -0
  44. data/lib/wice/columns/column_float.rb +9 -0
  45. data/lib/wice/columns/column_html5_datepicker.rb +31 -0
  46. data/lib/wice/columns/column_integer.rb +78 -0
  47. data/lib/wice/columns/column_jquery_datepicker.rb +49 -0
  48. data/lib/wice/columns/column_processor_index.rb +23 -0
  49. data/lib/wice/columns/column_rails_date_helper.rb +41 -0
  50. data/lib/wice/columns/column_rails_datetime_helper.rb +40 -0
  51. data/lib/wice/columns/column_range.rb +72 -0
  52. data/lib/wice/columns/column_string.rb +92 -0
  53. data/lib/wice/columns/common_date_datetime_mixin.rb +20 -0
  54. data/lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb +42 -0
  55. data/lib/wice/columns/common_js_date_datetime_mixin.rb +15 -0
  56. data/lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb +26 -0
  57. data/lib/wice/columns/common_standard_helper_date_datetime_mixin.rb +22 -0
  58. data/lib/wice/grid_output_buffer.rb +49 -0
  59. data/lib/wice/grid_renderer.rb +609 -0
  60. data/lib/wice/helpers/bs_calendar_helpers.rb +66 -0
  61. data/lib/wice/helpers/js_calendar_helpers.rb +83 -0
  62. data/lib/wice/helpers/wice_grid_misc_view_helpers.rb +75 -0
  63. data/lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb +95 -0
  64. data/lib/wice/helpers/wice_grid_view_helpers.rb +718 -0
  65. data/lib/wice/kaminari_monkey_patching.rb +14 -0
  66. data/lib/wice/table_column_matrix.rb +65 -0
  67. data/lib/wice/wice_grid_controller.rb +223 -0
  68. data/lib/wice/wice_grid_core_ext.rb +142 -0
  69. data/lib/wice/wice_grid_misc.rb +209 -0
  70. data/lib/wice/wice_grid_serialized_queries_controller.rb +87 -0
  71. data/lib/wice/wice_grid_serialized_query.rb +14 -0
  72. data/lib/wice/wice_grid_spreadsheet.rb +20 -0
  73. data/lib/wice_grid.rb +676 -0
  74. data/release_notes/RELEASE_NOTES_3.2.pre1.rdoc +81 -0
  75. data/release_notes/RELEASE_NOTES_3.2.pre2.rdoc +6 -0
  76. data/release_notes/RELEASE_NOTES_3.3.0.rdoc +21 -0
  77. data/spec/schema.rb +9 -0
  78. data/spec/spec_helper.rb +75 -0
  79. data/spec/support/active_record.rb +11 -0
  80. data/spec/support/wice_grid_test_config.rb +175 -0
  81. data/spec/wice/grid_output_buffer_spec.rb +41 -0
  82. data/spec/wice/table_column_matrix_spec.rb +38 -0
  83. data/spec/wice/wice_grid_misc_spec.rb +159 -0
  84. data/spec/wice/wice_grid_spreadsheet_spec.rb +14 -0
  85. data/test/readme.txt +1 -0
  86. data/vendor/assets/javascripts/wice_grid.js +3 -0
  87. data/vendor/assets/javascripts/wice_grid_init.js.coffee +339 -0
  88. data/vendor/assets/javascripts/wice_grid_processor.js.coffee +133 -0
  89. data/vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee +103 -0
  90. data/vendor/assets/stylesheets/wice_grid.scss +81 -0
  91. data/wice_grid.gemspec +36 -0
  92. metadata +335 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3795010568ced56480c0ab520b69a91385c41f1c
4
+ data.tar.gz: 53ad1ad69e0d9f8e121c8db7facc18334db3bc45
5
+ SHA512:
6
+ metadata.gz: 0de943255c22ac0d8406b9cbed72a938d0191afe1769d5183e91e8b63de164817fa6d0fbb7e1f8b107684ad5f70280fa74482a6fa510e998228527175c0ea47d
7
+ data.tar.gz: dbe5fa62a67d6b5cb1555142dff58844679c0c46f06fc6fb309b3f077fa792fd96a942b984153921e37b2e0f6291a8d6251b356f8b212a1b674b98f5efeca8f4
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .idea
6
+ .yardoc
7
+ .rbenv-version
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/.inch.yml ADDED
@@ -0,0 +1,3 @@
1
+ files:
2
+ excluded:
3
+ - lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format d
data/.rubocop.yml ADDED
@@ -0,0 +1,181 @@
1
+ AllCops:
2
+ DisabledByDefault: true
3
+
4
+ Style/MultilineTernaryOperator:
5
+ Enabled: true
6
+
7
+ # Cop supports --auto-correct.
8
+ Style/DefWithParentheses:
9
+ Enabled: true
10
+
11
+ # Cop supports --auto-correct.
12
+ Style/MethodCallParentheses:
13
+ Enabled: true
14
+
15
+ # Cop supports --auto-correct.
16
+ # Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
17
+ Style/SpaceAroundBlockParameters:
18
+ Enabled: true
19
+
20
+ # Cop supports --auto-correct.
21
+ # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
22
+ Style/TrailingComma:
23
+ Enabled: true
24
+
25
+ # Cop supports --auto-correct.
26
+ Style/SingleSpaceBeforeFirstArg:
27
+ Enabled: true
28
+
29
+ # Cop supports --auto-correct.
30
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
31
+ Style/FirstParameterIndentation:
32
+ Enabled: true
33
+
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: AllowSafeAssignment.
36
+ Style/ParenthesesAroundCondition:
37
+ Enabled: true
38
+
39
+ # Cop supports --auto-correct.
40
+ Style/SpecialGlobalVars:
41
+ Enabled: true
42
+
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: IgnoredMethods.
45
+ Style/SymbolProc:
46
+ Enabled: true
47
+
48
+ # Cop supports --auto-correct.
49
+ Style/Lambda:
50
+ Enabled: true
51
+
52
+ # Cop supports --auto-correct.
53
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
54
+ Style/MethodDefParentheses:
55
+ Enabled: true
56
+
57
+ # Cop supports --auto-correct.
58
+ Style/EmptyLiteral:
59
+ Enabled: true
60
+
61
+ # Cop supports --auto-correct.
62
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
63
+ Style/HashSyntax:
64
+ Enabled: true
65
+
66
+ # Cop supports --auto-correct.
67
+ Style/Not:
68
+ Enabled: true
69
+
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: AllowMultipleReturnValues.
72
+ Style/RedundantReturn:
73
+ Enabled: true
74
+
75
+ # Cop supports --auto-correct.
76
+ Style/SpaceAfterComma:
77
+ Enabled: true
78
+
79
+ # Cop supports --auto-correct.
80
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
81
+ Style/SignalException:
82
+ Enabled: true
83
+
84
+ # Cop supports --auto-correct.
85
+ Style/LineEndConcatenation:
86
+ Enabled: true
87
+
88
+ # Cop supports --auto-correct.
89
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
90
+ Style/AndOr:
91
+ Enabled: true
92
+
93
+ # Cop supports --auto-correct.
94
+ # Configuration parameters: PreferredDelimiters.
95
+ Style/PercentLiteralDelimiters:
96
+ Enabled: true
97
+
98
+ # Cop supports --auto-correct.
99
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AutoCorrectEncodingComment.
100
+ Style/Encoding:
101
+ Enabled: true
102
+
103
+ # Cop supports --auto-correct.
104
+ Lint/UnusedMethodArgument:
105
+ Enabled: true
106
+
107
+ # Cop supports --auto-correct.
108
+ Style/AlignArray:
109
+ Enabled: true
110
+
111
+ # Cop supports --auto-correct.
112
+ Style/ColonMethodCall:
113
+ Enabled: true
114
+
115
+ # Cop supports --auto-correct.
116
+ Lint/UnusedBlockArgument:
117
+ Enabled: true
118
+
119
+ # Cop supports --auto-correct.
120
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
121
+ Style/DotPosition:
122
+ Enabled: true
123
+
124
+ # Cop supports --auto-correct.
125
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
126
+ Style/EmptyElse:
127
+ Enabled: true
128
+
129
+ # Cop supports --auto-correct.
130
+ # Configuration parameters: MultiSpaceAllowedForOperators.
131
+ Style/SpaceAroundOperators:
132
+ Enabled: true
133
+
134
+ # Cop supports --auto-correct.
135
+ Style/SpaceBeforeComma:
136
+ Enabled: true
137
+
138
+ # Cop supports --auto-correct.
139
+ Style/SpaceInsideParens:
140
+ Enabled: true
141
+
142
+ # Cop supports --auto-correct.
143
+ Style/DeprecatedHashMethods:
144
+ Enabled: true
145
+
146
+ # Cop supports --auto-correct.
147
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
148
+ Style/BlockDelimiters:
149
+ Enabled: true
150
+
151
+ # Cop supports --auto-correct.
152
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
153
+ Style/BracesAroundHashParameters:
154
+ Enabled: true
155
+
156
+ Lint/AmbiguousRegexpLiteral:
157
+ Enabled: true
158
+
159
+ # Cop supports --auto-correct.
160
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
161
+ Style/StringLiterals:
162
+ Enabled: true
163
+
164
+ Lint/AmbiguousOperator:
165
+ Enabled: true
166
+
167
+ Lint/UselessAssignment:
168
+ Enabled: true
169
+
170
+ # Cop supports --auto-correct.
171
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
172
+ Style/ClassCheck:
173
+ Enabled: true
174
+
175
+ # Cop supports --auto-correct.
176
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
177
+ Style/AlignParameters:
178
+ Enabled: true
179
+
180
+ Lint/ConditionPosition:
181
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ sudo: false
2
+ cache: bundler
3
+ language: ruby
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1.6
7
+ - 2.2.2
8
+ - ruby-head
9
+ - jruby-19mode
10
+ - rbx-2
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ - rvm: jruby-19mode
15
+ - rvm: rbx-2
16
+ - rvm: 1.9.3
17
+ fast_finish: true
18
+ before_install: gem update --remote bundler
19
+ install:
20
+ - bundle install --retry=3
21
+ script:
22
+ - bundle exec rake
data/CHANGELOG.md ADDED
@@ -0,0 +1,714 @@
1
+ # 3.6.0
2
+
3
+ ## New API For Joined Tables
4
+
5
+ Before 3.6.0 `:model_class` was used in column definitions for columns from joined tables.
6
+
7
+ In 3.6.0 the API has changed to use associations.
8
+ If, say, a `Task` `belongs_to` a `Priority`, a column definition should specify this association using `:assoc`:
9
+
10
+ ```ruby
11
+ g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
12
+ task.priority.name if task.priority
13
+ end
14
+ ```
15
+
16
+ If, say, a `Task` `belongs_to` a `Project`, and a `Project` belongs to a `Customer`,
17
+ `assoc:` should be a list of these associations:
18
+
19
+ ```ruby
20
+ g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
21
+ task.project.customer.name if task.project && task.project.customer
22
+ end
23
+ ```
24
+
25
+
26
+ ## Blockless Columns For Joined Tables
27
+
28
+ Blockless columns used to only work for the main model.
29
+ Now they can be used for joined tables, too.
30
+
31
+ Instead of
32
+
33
+ ```ruby
34
+ g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
35
+ task.priority.name if task.priority
36
+ end
37
+ ```
38
+
39
+ you can write
40
+
41
+ ```ruby
42
+ g.column name: 'Priority', attribute: 'name', assoc: :priority
43
+ ```
44
+
45
+ Instead of
46
+
47
+ ```ruby
48
+ g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
49
+ task.project.customer.name if task.project && task.project.customer
50
+ end
51
+ ```
52
+
53
+ you can write
54
+
55
+ ```ruby
56
+ g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer]
57
+ ```
58
+
59
+
60
+ ## New Way To Choose Datepickers
61
+
62
+ Before 3.6.0 to choose a datepicker type we used `:helper_style` in column definitions and `Wice::Defaults:HELPER_STYLE` in the configuration_file.
63
+
64
+ In 3.6.0 `:helper_style` and `Wice::Defaults:HELPER_STYLE` are gone.
65
+
66
+ Now each datepicker is simply a separate filter type, and to pick a datepicker we can use `:filter_type`, just like other filter types are chosen.
67
+
68
+ Filter types for dates and datetimes are
69
+
70
+ * `:rails_datetime_helper`
71
+ * `:rails_date_helper`
72
+ * `:jquery_datepicker`
73
+ * `:bootstrap_datepicker`
74
+
75
+ Example:
76
+
77
+ ```ruby
78
+ g.column name: 'Updated', attribute: 'updated_at', filter_type: :rails_datetime_helper do |task|
79
+ task.updated_at.to_s(:db)
80
+ end
81
+ ```
82
+
83
+ Default filter types for date and datetime columns are set by `Wice::Defaults:DEFAULT_FILTER_FOR_DATE` and `Wice::Defaults:DEFAULT_FILTER_FOR_DATETIME`.
84
+
85
+
86
+ ## Icons
87
+
88
+ There are no more icons inside of the gem. Instead, [Font Awesome](https://github.com/FortAwesome/font-awesome-sass) is used.
89
+
90
+ ## CSS
91
+
92
+ CSS is no longer copied to the applications asset directory. Instead the user is supposed to add
93
+
94
+ ```sass
95
+ @import "wice_grid";
96
+ @import "font-awesome-sprockets";
97
+ @import "font-awesome";
98
+ ```
99
+
100
+ to `application.scss`.
101
+
102
+ `font-awesome-sass` is not a dependency of WiceGrid in case you decide to style WiceGrid icons differently,
103
+ so you need to add it explicitly to your Gemfile:
104
+
105
+ ```ruby
106
+ gem 'font-awesome-sass', '~> 4.3'
107
+ ```
108
+
109
+
110
+ ## CI_LIKE
111
+
112
+ Setting a configuration value in Wice::Defaults::STRING_MATCHING_OPERATORS to CI_LIKE will result in the following SQL generated for string filters:
113
+
114
+ ```sql
115
+ UPPER(table.field) LIKE UPPER(?)"
116
+ ```
117
+
118
+
119
+ ## USE_DEFAULT_SCOPE
120
+
121
+ New `USE_DEFAULT_SCOPE` configuration value from @nathanvda.
122
+ By default ActiveRecord calls are always executed inside `Model.unscoped{}`.
123
+ Setting `USE_DEFAULT_SCOPE` to `true` will use the default scope for all queries.
124
+
125
+
126
+ # 3.5.0
127
+
128
+ * In addition to two icons "SET ALL" and "UNSET ALL" in the action column, there is now
129
+ an option to use a standard HTML checkbox. This is now the default.
130
+ * Support for Bootstrap Datepicker. A suggested way to use Bootstrap Datepicker in a Rails app
131
+ is https://github.com/Nerian/bootstrap-datepicker-rails. Configuration variable HELPER_STYLE
132
+ sets the default flavor of date pickers. Can also be set per grid with helper_style: :bootstrap
133
+ * :calendar jQuery UI datepicker
134
+ * :bootstrap Bootstrap datepicker
135
+ * :standard
136
+ * Italian locale
137
+ * Spanish locale
138
+ * various fixes
139
+ * Configuration variable ALLOW_SHOWING_ALL_QUERIES renamed to ALLOW_SHOWING_ALL_RECORDS
140
+
141
+
142
+
143
+ # 3.4.14
144
+
145
+ Wice::Defaults::HIDE_ALL_LINK_FROM is nil by default
146
+
147
+ # 3.4.13
148
+
149
+ New configuration variable Wice::Defaults::HIDE_ALL_LINK_FROM! When set and the total
150
+ number of row exceeds its value, the "SHOW ALL" link disappears.
151
+
152
+ # 3.4.12
153
+
154
+ fixes
155
+
156
+ # 3.4.11
157
+
158
+ started adding HTML5 datepicker
159
+ changed how relations are detected so that it can work with relation proxies (aka octopus)
160
+
161
+ # 3.4.10
162
+
163
+ bug fixes
164
+ better support for :group
165
+
166
+ # 3.4.9
167
+
168
+ better support for Asset Pipeline
169
+
170
+ bugfixes
171
+
172
+ dropped support for Ruby 1.8
173
+
174
+ # 3.4.8
175
+
176
+ a friendlier exception message when a constant is missing in wice_grid_config.rb
177
+
178
+ bugfixes
179
+
180
+ # 3.4.6
181
+
182
+ Better support for Turbolinks
183
+
184
+ Better support for ActiveRelation #references
185
+
186
+ variable Wice::Defaults::PAGE_METHOD_NAME
187
+
188
+ # 3.4.5
189
+
190
+ Support for ActiveRelation #references
191
+
192
+ bugfixes
193
+
194
+ # 3.4.4
195
+
196
+ bugfixes
197
+
198
+ # 3.4.3
199
+
200
+ bugfixes
201
+
202
+ # 3.4.2
203
+
204
+ External columns processors
205
+
206
+ Operators '<','>','<=','>=','=' in the integer column
207
+
208
+ Bugfixes
209
+
210
+ # 3.4.1
211
+
212
+ Support for Bootstrap 3
213
+
214
+ # 3.4.0
215
+
216
+ Support for Rails 4
217
+
218
+ # 3.3.0
219
+
220
+ The with_paginated_resultset callback receives an ActiveRelation object, not a lambda
221
+
222
+ Wice::Defaults::DATEPICKER_YEAR_RANGE added to the config to define the default year range in Datepicker (https://github.com/leikind/wice_grid/issues/61)
223
+
224
+ Improvement of the javascript calendar control: if the FROM field is set to a value after TO, TO is set to the value of FROM.
225
+ Vice versa: if the TO field is set to a value before FROM, FROM is set to the value of TO
226
+
227
+ New view helpers filter_and_order_state_as_hash(grid) and filter_state_as_hash(grid)
228
+
229
+ HTML tag caption supported
230
+
231
+ Support for Ruby 2.0
232
+
233
+ 2 errors fixed in the Saved Queries UI ( https://github.com/leikind/wice_grid/issues/89 )
234
+
235
+ Bug fixed: extra_request_parameters not propagating to the pagination panel
236
+
237
+ Documentation improvements
238
+
239
+ # 3.2.2
240
+
241
+ improvement of the javascript calendar control: if the FROM field is set to a value after TO, TO is set to the value of FROM.
242
+ Vice versa: if the TO field is set to a value before FROM, FROM is set to the value of TO
243
+
244
+ Wice::Defaults::DATEPICKER_YEAR_RANGE added to the config to define the default year range in Datepicker (https://github.com/leikind/wice_grid/issues/61)
245
+
246
+ support for Ruby 2.0
247
+
248
+ <caption> supported
249
+
250
+ 2 js errors fixed in the Saved Queries UI ( https://github.com/leikind/wice_grid/issues/89
251
+
252
+ helpers filter_and_order_state_as_hash(grid) and filter_state_as_hash(grid)
253
+
254
+ the with_paginated_resultset callback receives an ActiveRelation object, not a lambda
255
+
256
+ # 3.2.1
257
+
258
+ action_column can now also take a block. If the block returns a falsy value, no checkbox will be rendered.
259
+
260
+ A fix: the css class submitted to column is also added to the <th> tags of the column.
261
+
262
+ Filter related code has been refactored: condition generators are unified together with view column processors into one module. Writing your own filters has been simplified.
263
+
264
+ The default filter for numeric columns has been replaced by a simple one field filter which checks the values for equality, not the inclusion in a range.
265
+ New column parameter :filter_type allows to load custom alternative filters.
266
+ The old numeric range filter can still be used by specifying filter_type: :range. See lib/columns/column_processor_index.rb for the list of available filters.
267
+
268
+ # 3.2.0
269
+
270
+ Fixes:
271
+ https://github.com/leikind/wice_grid/issues/83
272
+ https://github.com/leikind/wice_grid/issues/82
273
+
274
+ action_column can now also take a block. If the block returns a falsy value, no checkbox will be rendered
275
+
276
+ A fix: the css class submitted to column is also added to <th> tags of the column
277
+
278
+ Filter related code has been refactored: condition generators are unified together with view column processors into one module. Writing your own filters has been simplified.
279
+
280
+ The default filter for numeric columns has been replaced by a simple one field filter which checks the values for equality, not the inclusion in a range.
281
+ New column parameter :filter_type allows to load custom alternative filters. The old numeric range filter can still be used by specifying filter_type: :range.
282
+ See lib/columns/column_processor_index.rb</tt> for the list of available filters.
283
+
284
+
285
+ # 3.0.4
286
+
287
+ bugfixes
288
+
289
+ # 3.0.3
290
+
291
+ bugxixes
292
+
293
+ # 3.0.2
294
+
295
+ bugxixes
296
+
297
+ # 3.0.1
298
+
299
+ Fixed the "Cannot modify SafeBuffer in place" problem and thus Rails # 3.0.8 and # 3.0.9
300
+ Support for ActiveRecord::Relation
301
+
302
+ # 3.0.0
303
+
304
+ Rails 3 support
305
+
306
+ 0.6
307
+
308
+ wice_grid_custom_filter_params used to be a view helper, not it is also accessible from the controller, to be used in cases like redirect_to(my_resource_path(wice_grid_custom_filter_params(...)))
309
+
310
+ auto reloading filters
311
+
312
+ helper export_to_csv_javascript to create custom CSV buttons
313
+
314
+ option :hide_csv_button to hide the default CSV export button
315
+
316
+ Method WiceGrid#selected_records and parameter :after were a bit of a mess and have been substituted by
317
+
318
+ * WiceGrid#current_page_records returning records on the current page
319
+ * WiceGrid#all_pages_records returning records browsable throughout all pages
320
+ * :with_paginated_resultset - callback to process records on the current page
321
+ * :with_resultset - callback to process records browsable throughout all pages
322
+
323
+ Compliant with Rails 1.2.8 with or without rails_xss and erubis
324
+
325
+ Ruby 1.9.1 compliance
326
+
327
+ Dropdowns generated with :custom_filter => :auto and :custom_filter => [method chain] are now ordered by option labels
328
+
329
+ how_filters => false is the same as :show_filters => :no and :show_filters => true is the same as :show_filters => :always
330
+
331
+ action_column - Adds a column with checkboxes for each record.
332
+ Useful for actions with multiple records, for example, delete
333
+ the selected records.
334
+
335
+ using merge_conditions to merge conditions :)
336
+
337
+ WiceGrid is now compatible with the new Rails XSS behavior which
338
+ will be the default in Rails # 3.0 and can be used in Rails 2.3.5
339
+ using the rails_xss plugin.
340
+ Read http://github.com/nzkoz/rails_xss for more
341
+
342
+ wice_grid_custom_filter_params
343
+
344
+ support for with_scope and with_exclusive_scope
345
+
346
+ :total_entries parameter added to initialize_grid (will_paginate)
347
+
348
+ Localization
349
+
350
+ assert_keys wherever possible
351
+
352
+ == 0.5
353
+
354
+ Today "WiceGrid":http://leikind.org/pages/wicegrid has reached its next level of maturity and was awarded the tag of version 0.5.
355
+
356
+ This version of WiceGrid is accompanied by an application called _WiceGrid Examples_ running "online":http://grid.leikind.org/ and with source code available on "GitHub":http://github.com/leikind/wice_grid_examples.
357
+
358
+ Here's a list of changes as compared with "version 0.4":https://blog.wice.eu/2009/7/6/moving-to-github-and-wicegrid-version-0-4 :
359
+
360
+
361
+ --- RHTML
362
+ <%= grid(@tasks_grid) do |g|
363
+ ...
364
+ end -%>
365
+
366
+ <% selected = @tasks_grid.selected_records %>
367
+ <p><%= selected.size %> records selected: <%= selected.map(&:id).to_sentence %></p>
368
+ ---
369
+
370
+ "See an online example":http://grid.leikind.org/integration_with_application_view
371
+
372
+ h4. placement of filter related icons
373
+
374
+ A change in placement of filter related icons (filter icon, reset icon, show/hide icon): if the last column doesn't have any filter or a column name, icons will be placed in the header of this column, otherwise it falls back to the usual behavior when an additional table column is added. To change the behavior back to the old style, set @Wice::Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS@ to @false@ in the configuration file.
375
+
376
+ "See an online example":http://grid.leikind.org/custom_filters2
377
+
378
+
379
+ h4. wice_grid_assets generator
380
+
381
+ Copying asset files (images, css, js, and the configuration file) is now done by a plugin generator, not rake tasks:
382
+
383
+ ---
384
+ ./script/generate wice_grid_assets
385
+ ---
386
+
387
+ h4. blank slate
388
+
389
+ Blank slate feature: it is now possible to replace the grid with some alternative view if no filters are active and there are no records to render:
390
+
391
+ --- RHTML
392
+ <%= grid(@grid) do |g|
393
+
394
+ g.blank_slate do
395
+ "There are no records"
396
+ end
397
+
398
+ g.column do |product|
399
+ ...
400
+ end
401
+ end -%>
402
+ ---
403
+
404
+ There are also two alternative three ways to do it:
405
+
406
+ --- Ruby
407
+ g.blank_slate "some text to be rendered"
408
+ ---
409
+ and
410
+ --- Ruby
411
+ g.blank_slate :partial => "partial_name"
412
+ ---
413
+
414
+ "See an online example":http://grid.leikind.org/no_records
415
+
416
+ h4. custom filters with symbols
417
+
418
+ Improvement to custom filters, namely to
419
+ --- Ruby
420
+ :custom_filter => :symbol
421
+ ---
422
+ and
423
+ --- Ruby
424
+ :custom_filter => [:symbol1, :symbol2, :symbol3]
425
+ ---
426
+
427
+ Now, if the last method returns an array of 2 elements, the first element becomes the select option label and the second - the select option value (usually @id@).
428
+
429
+ Before this change the value returned by the method had been used for both the value and the label of the select option.
430
+
431
+ "See an online example":http://grid.leikind.org/custom_filters3
432
+
433
+ h4. custom filters and NULL
434
+
435
+ Values @null@ and @not null@ in a generated custom filter dropdown are treated specially, as SQL @null@ statement and not as strings. Value @null@ is transformed into SQL condition @IS NULL@, and @not null@ into @IS NOT NULL@ .
436
+
437
+ Thus, if in a filter defined by
438
+
439
+ --- Ruby
440
+ :custom_filter => {'No' => 'null', 'Yes' => 'not null', '1' => 1, '2' => '2', '3' => '3'}
441
+ ---
442
+ values @1@, @2@ and @'No'@ are selected (in a multi-select mode), this will result in the following SQL:
443
+
444
+ --- SQL
445
+ ( table.field IN ( '1', '2' ) OR table.field IS NULL )
446
+ ---
447
+
448
+ "See an online example":http://grid.leikind.org/null_values
449
+
450
+ h4. Wice::Defaults::STRING_MATCHING_OPERATORS
451
+
452
+ in addition to the configuration constant @Wice::Defaults::STRING_MATCHING_OPERATOR@ to define the operator for matching strings (@LIKE@ in most cases), hash @Wice::Defaults::STRING_MATCHING_OPERATORS@ was added to specify string matching operators on per-database basis:
453
+
454
+ --- Ruby
455
+ Wice::Defaults::STRING_MATCHING_OPERATORS = {
456
+ 'ActiveRecord::ConnectionAdapters::MysqlAdapter' => 'LIKE',
457
+ 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => 'ILIKE'
458
+ }
459
+ ---
460
+
461
+ A use-case for this is a Rails application connecting to two databases, one of which is MySQL, and the other is Postgresql. To use case-insensitive matching in Postgresql 'ILIKE' has to be used, but this operator is unknown to MySQL.
462
+
463
+ h4. td_html_attrs and table_html_attrs shortcuts
464
+
465
+ @:td_html_attrs@ in column definitions and @table_html_attrs@ in the table definitions are mostly used to add css classes, so a shorter way has been added to add css classes.
466
+
467
+ Instead of
468
+
469
+ --- RHTML
470
+ <%= grid(@grid, :table_html_attrs => {:class => 'css_class1'}) do |g|
471
+ g.column(:td_html_attrs => {:class => 'css_class2'}) do
472
+ ...
473
+ end
474
+ end -%>
475
+ ---
476
+
477
+ It's possible to just use the new @:class@ option:
478
+
479
+ --- RHTML
480
+ <%= grid(@grid, :class => 'css_class1') do |g|
481
+ g.column(:class => 'css_class2') do
482
+ end
483
+ end -%>
484
+ ---
485
+
486
+ h4. allow_multiple_selection
487
+
488
+ New options for @column@: @:allow_multiple_selection@, use @:allow_multiple_selection => false@ to disable switching between single and multiple selection modes for custom dropdown boxes.
489
+
490
+ "See an online example":http://grid.leikind.org/custom_filters4
491
+
492
+ h4. allow_ordering
493
+
494
+ New parameter for @column@: @:allow_ordering@. Use @:allow_ordering => false@ to disable the ordering of the column.
495
+
496
+ "See an online example":http://grid.leikind.org/basics6
497
+
498
+ h4. allow_showing_all_records
499
+
500
+ Parameter @:allow_showing_all_records@ moved from @initialize_grid@ to the view helper.
501
+
502
+ h4. other
503
+
504
+ * Default styles updated.
505
+ * Javascript code cleaned up and refactored.
506
+ * Quite some number of bugs fixed
507
+
508
+ == 0.4
509
+
510
+ * Detached filters: it has become possible to detach filters and place them anywhere on the page, before or after the grid.
511
+ Read section "Detached Filters" in the README.
512
+
513
+ * More control over Submit and Reset buttons.
514
+ Two new view helpers: submit_grid_javascript returns javascript which applies current filters; reset_grid_javascript returns javascript
515
+ which resets the grid, clearing the state of filters. This allows to create your own Submit and Reset buttons anywhere on the page
516
+ with the help of button_to_function:
517
+
518
+ <%= button_to_function "Submit", submit_grid_javascript(@grid) %>
519
+ <%= button_to_function "Reset", reset_grid_javascript(@grid) %>
520
+
521
+ To complement this feature there are two new parameters in the +grid+ helper :hide_submit_button and :hide_reset_button which
522
+ hide default buttons in the grid if set to true. Together with detached filter this allows to completely
523
+ get rid of the filter row with filters and icons.
524
+
525
+ * erb_mode option has been moved to the grid view helper - watch for warnings and remove the parameter from initialize_grid if you have it there.
526
+
527
+ * helper include_wice_grid_assets will require WiceGrid javascripts and stylesheets on demand, that is, only if at least one initialize_grid
528
+ has been called in the controller. Otherwise the helper returns an empty string. However, you can force the old unconditioned behavior if you
529
+ need by submitting parameter :load_on_demand set to false:
530
+ <%= include_wice_grid_assets(:load_on_demand => false) %>
531
+
532
+ * Compatibility with Rails asset caching. Helpers names_of_wice_grid_stylesheets and names_of_wice_grid_javascripts return names of stylesheet and
533
+ javascript files and can be used with stylesheet_link_tag and javascript_include_tag with :cache => true. Using this trick you have to deal with
534
+ the parameters correctly, mind that Prototype has to be loaded before WiceGrid javascripts:
535
+
536
+ <%= stylesheet_link_tag *(['core', 'modalbox'] + names_of_wice_grid_stylesheets + [ {:cache => true}]) %>
537
+ <%= javascript_include_tag *([:defaults] + names_of_wice_grid_javascripts + [ 'ui', 'swfobject', {:cache => true}]) %>
538
+
539
+ * When a page with a WiceGrid instance is loaded there is check a small chunk of javascript that checks whether Prototype is loaded and whether
540
+ the main WiceGrid javascript files is loaded and is of the correct version. Problems are reported to the user via alert() dialog boxes.
541
+ This check has now been disabled in the production mode.
542
+
543
+ * The default field separator in generated CSV (comma) can now be overridden by setting :enable_export_to_csv to a string instead of +true+.
544
+
545
+ * It is possible to add your own handcrafted HTML after and/or before each grid row. This works similar to +row_attributes+,
546
+ by adding blocks after_row and before_row:
547
+
548
+ <%= grid(@tasks_grid) do |g|
549
+ g.before_row do |task|
550
+ if task.active?
551
+ "<tr><td colspan=\"10\">Custom line for #{t.name}</td></tr>" # this would add a row
552
+ # before every active task row
553
+ else
554
+ nil
555
+ end
556
+ end
557
+ .......
558
+ end %>
559
+
560
+
561
+
562
+ * Bug fixes
563
+
564
+ * Refactoring
565
+ =============
566
+
567
+ === 03/04/2009
568
+
569
+ Possibility to add custom lines after and/or before a grid row.
570
+
571
+
572
+ === 16/03/2009
573
+
574
+ Option to override the default field separator in generated CSV (comma).
575
+
576
+
577
+ === 13/02/2009
578
+
579
+ a bug fix for incorrect generation if dom ids for javascript calendar filter. Happened only for columns belonging to joined tables
580
+
581
+ === 12/01/2009
582
+
583
+ WiceGrid 0.3 released
584
+
585
+ === 12/01/2009
586
+
587
+ All records mode
588
+
589
+ === 10/12/2008
590
+
591
+ custom_filter made Rails-compliant, a new flavor - Array of two-element arrays
592
+
593
+ === 4/12/2008
594
+ A single helper to include all assets in a page
595
+
596
+ A javascript error message if Prototype is not loaded
597
+
598
+ A javascript error message if wice_grid.js is not loaded
599
+
600
+ Added status info to the pagination line:
601
+ « Previous 1 2 3 Next » 1-20 / 50
602
+
603
+ === 3/12/2008
604
+ First implementation of saved queries
605
+
606
+
607
+ === 25/11/2008
608
+
609
+ Negation for string filters: match records where this fiels DOES NOT include the given fragment.
610
+
611
+ === 24/11/2008
612
+
613
+ The string matching operator for string filters (LIKE) has been moved to wice_grid_config.rb in order to make it easier to substitute it with
614
+ something else, for example, ILIKE of Postgresql.
615
+
616
+
617
+ === 19/11/2008
618
+
619
+ Experimental feature : :table_alias parameter to allow ordering and filtering for joining associations referring the same table.
620
+ (See "Joined associations referring to the same table" in README)
621
+
622
+ === 18/11/2008
623
+
624
+ Refactoring
625
+
626
+ === 6/11/2008
627
+
628
+ Ability to provide a callback to a Proc object or a method, the callback will be called with the objects of the current selection of
629
+ objects (throughout all pages). Can be used to use the WiceGrid filters set up by the user for further processing of the user's selection of
630
+ objects.
631
+
632
+ === 5/11/2008
633
+
634
+ Javascript calendars as Date/Datetime filters
635
+
636
+
637
+ === 4/11/2008
638
+
639
+ Ability to inject custom sql code into the ORDER BY clause, for example, ORDER BY char_length(table1.foo)
640
+
641
+ === 4/11/2008
642
+
643
+ Creates a new branch for version 2.3
644
+
645
+
646
+
647
+ === 21/10/2008
648
+
649
+ A bugfix related to custom filters influencing other columns with filters
650
+ A more informative error message if the grid can't find the underlying database column for a view column (incorrect :column_name and :model)
651
+
652
+ === 8/10/2008
653
+
654
+ New view helper parameter <tt>:sorting_dependant_row_cycling</tt> - When set to true (by default it is false) the row styles +odd+ and +even+
655
+ will be changed only when the content of the cell belonging to the sorted column changes. In other words, rows with identical values in the
656
+ ordered column will have the same style (color).
657
+
658
+ === 3/10/2008
659
+
660
+ For simple columns like
661
+
662
+ g.column :column_name => 'Username', :attribute_name => 'username' do |account|
663
+ account.username
664
+ end
665
+
666
+ the following blockless shortcut can be used:
667
+
668
+ g.column :column_name => 'Username', :attribute_name => 'username'
669
+
670
+ In this case +attribute_name+ will be used as the method name to send to the ActiveRecord instance.
671
+
672
+ === revision 27 (30/09/2008)
673
+
674
+ * CSV export
675
+ * Custom filters can switch between a dropdown list and a multiple select list, thus allowing to search for records matching
676
+ more that one value (operator OR)
677
+
678
+ === revision 17 (19/08/2008)
679
+
680
+ * A bug fixed: extra_request_parameters did not propagate to will_paginate page panel. Now it does.
681
+
682
+ === revision 13 (6/08/2008)
683
+
684
+ * File <tt>config.rb</tt> renamed.
685
+ * New parameters for +column+ :
686
+ * <tt>:boolean_filter_true_label</tt> - overrides the default value for <tt>BOOLEAN_FILTER_TRUE_LABEL</tt> ('+yes+') in the config.
687
+ Only has effect in a column with a boolean filter.
688
+ * <tt>:boolean_filter_false_label</tt> - overrides the default value for <tt>BOOLEAN_FILTER_FALSE_LABEL</tt> ('+no+') in the config.
689
+ Only has effect in a column with a boolean filter.
690
+ * <tt>:filter_all_label</tt> - overrides the default value for <tt>BOOLEAN_FILTER_FALSE_LABEL</tt> ('<tt>--</tt>') in the config.
691
+ Has effect in a column with a boolean filter _or_ a custom filter.
692
+
693
+ === revision 11
694
+
695
+ * New row_attributes method to dynamically generate HTML attributes for the <tt><tr></tt> tag:
696
+
697
+ <%= grid(@portal_applications_grid) do |g|
698
+ g.row_attributes{ |portal_application|
699
+ {:id => "#{@portal_applications_grid.name}_row_#{portal_application.id}"}
700
+ }
701
+
702
+ g.column{ |portal_application| ... }
703
+ g.column{ |portal_application| ... }
704
+ end -%>
705
+
706
+ * The column block can now optionally return an array of two values, where the first element is the cell
707
+ contents and the second is a hash of HTML attributes to be added for the <td> tag of the current cell.
708
+
709
+ === revision 10
710
+
711
+ * New parameter +grid+ parameter: <tt>:extra_request_parameters</tt>.
712
+ (Read http://redmine.wice.eu/api/wice_grid/classes/Wice/GridViewHelper.html#M000002)
713
+
714
+ === 0