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
@@ -0,0 +1,159 @@
1
+ # encoding: utf-8
2
+
3
+ context 'assoc_list_to_hash' do
4
+ it 'many elements in assocs' do
5
+ assocs = [:foo1, :foo2, :foo3, :foo4, :foo5]
6
+ out = Wice.assoc_list_to_hash(assocs)
7
+ expect(out).to eq(foo1: {foo2: {foo3: {foo4: :foo5}}})
8
+ end
9
+
10
+ it 'one element in assocs' do
11
+ assocs = [:foo1]
12
+ out = Wice.assoc_list_to_hash(assocs)
13
+ expect(out).to eq(:foo1)
14
+ end
15
+
16
+ it 'two elements in assocs' do
17
+ assocs = [:foo1, :foo2]
18
+ out = Wice.assoc_list_to_hash(assocs)
19
+ expect(out).to eq(foo1: :foo2)
20
+ end
21
+ end
22
+
23
+ context 'build_includes' do
24
+
25
+ it 'symbols + existing symbol' do
26
+ includes = [:a, :b, :c, :d, :e]
27
+
28
+ out = Wice.build_includes(includes, [:b])
29
+
30
+ expect(out).to eq([:a, :b, :c, :d, :e])
31
+ end
32
+
33
+ it 'symbols + non-existing symbol' do
34
+ includes = [:a, :b, :c, :d, :e]
35
+
36
+ out = Wice.build_includes(includes, [:x])
37
+
38
+ expect(out).to eq([:a, :b, :c, :d, :e, :x])
39
+ end
40
+
41
+ it 'symbols + non-existing hash' do
42
+ includes = [:a, :b, :c, :d, :e]
43
+
44
+ out = Wice.build_includes(includes, [:x, :y])
45
+
46
+ expect(out).to eq([:a, :b, :c, :d, :e, {x: :y}])
47
+ end
48
+
49
+
50
+ it 'symbols + existing hash' do
51
+ includes = [:a, :b, :c, :d, :e]
52
+
53
+ out = Wice.build_includes(includes, [:a, :x])
54
+
55
+ expect(out).to eq([{a: :x}, :b, :c, :d, :e])
56
+ end
57
+
58
+ it 'symbols with a hash + simple symbol' do
59
+ includes = [{a: :x}, :b, :c, :d, :e]
60
+
61
+ out = Wice.build_includes(includes, [:a])
62
+
63
+ expect(out).to eq([{a: :x}, :b, :c, :d, :e])
64
+ end
65
+
66
+ it 'symbols with a hash + hash' do
67
+ includes = [{a: :x}, :b, :c, :d, :e]
68
+
69
+ out = Wice.build_includes(includes, [:a, :x, :y])
70
+
71
+ expect(out).to eq([{a: {x: :y}}, :b, :c, :d, :e])
72
+ end
73
+
74
+ it 'symbols with a hash + hash (2)' do
75
+ includes = [{a: :x}, :b, :c, :d, :e]
76
+
77
+ out = Wice.build_includes(includes, [:a, :x])
78
+
79
+ expect(out).to eq([{a: :x}, :b, :c, :d, :e])
80
+ end
81
+
82
+ it 'symbols with a hash + the same hash' do
83
+ includes = [a: :x]
84
+
85
+ out = Wice.build_includes(includes, [:a, :x])
86
+
87
+ expect(out).to eq(a: :x)
88
+ end
89
+
90
+ it 'symbols with a hash + a deeper hash' do
91
+ includes = [{a: :x}]
92
+
93
+ out = Wice.build_includes(includes, [:a, :x, :y])
94
+
95
+ expect(out).to eq(a: {x: :y})
96
+ end
97
+
98
+ it 'a deeper hash + a deeper hash' do
99
+ includes = [a: {x: :y}]
100
+
101
+ out = Wice.build_includes(includes, [:a, :x, :z])
102
+
103
+ expect(out).to eq(a: [:y, :z])
104
+ end
105
+
106
+
107
+ it 'a deeper hash + the same deeper hash' do
108
+ includes = [{a: {x: :y}}]
109
+
110
+ out = Wice.build_includes(includes, [:a, :x, :y])
111
+
112
+ expect(out).to eq(a: {x: :y})
113
+ end
114
+
115
+ it '1 symbol + hash ' do
116
+ includes = :b
117
+
118
+ out = Wice.build_includes(includes, [:a, :x])
119
+
120
+ expect(out).to eq([:b, {a: :x}])
121
+ end
122
+
123
+ it 'nil + hash ' do
124
+ includes = nil
125
+
126
+ out = Wice.build_includes(includes, [:a, :x])
127
+
128
+ expect(out).to eq(a: :x)
129
+ end
130
+
131
+ it '1 symbol + nothing' do
132
+ includes = :b
133
+
134
+ out = Wice.build_includes(includes, [])
135
+
136
+ expect(out).to eq(:b)
137
+ end
138
+
139
+ it '1 symbol array + nothing' do
140
+ includes = [:b]
141
+
142
+ out = Wice.build_includes(includes, [])
143
+
144
+ expect(out).to eq(:b)
145
+ end
146
+
147
+ it 'validate_query_model' do
148
+ expect(Wice.get_query_store_model).to eq(WiceGridSerializedQuery)
149
+ end
150
+
151
+ it 'get_string_matching_operators' do
152
+ expect(Wice.get_string_matching_operators(Dummy)).to eq('LIKE')
153
+ end
154
+
155
+ it 'log' do
156
+ Wice.log('message')
157
+ end
158
+
159
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ describe Wice::Spreadsheet do
4
+ let(:spreadsheet){Wice::Spreadsheet.new('hello', ';')}
5
+
6
+ it 'should initialize' do
7
+
8
+ expect(spreadsheet.class).to eq(Wice::Spreadsheet)
9
+ end
10
+
11
+ it 'should add_row' do
12
+ spreadsheet << %w(hello world!)
13
+ end
14
+ end
data/test/readme.txt ADDED
@@ -0,0 +1 @@
1
+ integration tests are in a separate application: https://github.com/leikind/wice_grid_testbed
@@ -0,0 +1,3 @@
1
+ //= require wice_grid_processor
2
+ //= require wice_grid_init
3
+ //= require wice_grid_saved_queries_init
@@ -0,0 +1,339 @@
1
+ $(document).on 'page:load ready', -> initWiceGrid()
2
+
3
+ globalVarForAllGrids = 'wiceGrids'
4
+
5
+ initWiceGrid = ->
6
+
7
+ $(".wice-grid-container").each (index, wiceGridContainer) ->
8
+
9
+ gridName = wiceGridContainer.id
10
+ dataDiv = $(".wg-data", wiceGridContainer)
11
+
12
+ processorInitializerArguments = dataDiv.data("processor-initializer-arguments")
13
+
14
+ filterDeclarations = dataDiv.data("filter-declarations")
15
+
16
+ focusElementIfNeeded dataDiv.data("foc")
17
+
18
+ gridProcessor = new WiceGridProcessor(gridName,
19
+ processorInitializerArguments[0], processorInitializerArguments[1],
20
+ processorInitializerArguments[2], processorInitializerArguments[3],
21
+ processorInitializerArguments[4], processorInitializerArguments[5])
22
+
23
+ for filterDeclaration in filterDeclarations
24
+ do (filterDeclaration) ->
25
+ if filterDeclaration?
26
+ gridProcessor.register
27
+ filterName : filterDeclaration.filterName
28
+ detached : filterDeclaration.detached
29
+ templates : filterDeclaration.declaration.templates
30
+ ids : filterDeclaration.declaration.ids
31
+
32
+ unless window[globalVarForAllGrids]
33
+ window[globalVarForAllGrids] = {}
34
+
35
+ window[globalVarForAllGrids][gridName] = gridProcessor
36
+
37
+ # setting up stuff for in the context of each grid
38
+ setupSubmitReset wiceGridContainer, gridProcessor
39
+ setupCsvExport wiceGridContainer, gridProcessor
40
+ setupHidingShowingOfFilterRow wiceGridContainer
41
+ setupShowingAllRecords wiceGridContainer, gridProcessor
42
+ setupMultiSelectToggle wiceGridContainer
43
+ setupAutoreloadsForInternalFilters wiceGridContainer, gridProcessor
44
+ setupBulkToggleForActionColumn wiceGridContainer
45
+
46
+ setupAutoreloadsForExternalFilters()
47
+ setupExternalSubmitReset()
48
+ setupExternalCsvExport()
49
+ setupDatepicker()
50
+
51
+ # for all grids on oage because it does not matter which grid it is
52
+ setupMultiSelectToggle $('.wg-detached-filter')
53
+
54
+
55
+
56
+ moveDateBoundIfInvalidPeriod = (dataFieldNameWithTheOtherDatepicker, datepickerHiddenField, selectedDate, dateFormat, predicate) ->
57
+ if (datepickerId = datepickerHiddenField.data(dataFieldNameWithTheOtherDatepicker)) &&
58
+ (theOtherDatepicker = $(_datepickerId = "#" + datepickerId)) &&
59
+ (theOtherDate = theOtherDatepicker.datepicker('getDate')) &&
60
+
61
+ predicate(theOtherDate, selectedDate)
62
+ theOtherDatepicker.datepicker("setDate", selectedDate)
63
+ theOtherDatepicker.next().next().html $.datepicker.formatDate(dateFormat, selectedDate)
64
+
65
+
66
+ setupDatepicker = ->
67
+ if $('.date-filter.wg-jquery-datepicker').length != 0
68
+ setupJqueryUiDatepicker()
69
+
70
+ if $('.date-filter.wg-bootstrap-datepicker').length != 0
71
+ setupBootstrapDatepicker()
72
+
73
+
74
+ setupBootstrapDatepicker = ->
75
+ # check for bootstrap datepicker
76
+ unless $.fn.datepicker
77
+ alert """Seems like you do not have Bootstrap datepicker gem (https://github.com/Nerian/bootstrap-datepicker-rails)
78
+ installed. Either install it pick another filter with :filter_type.
79
+ """
80
+ return
81
+
82
+ $('.date-filter.wg-bootstrap-datepicker input:text[data-provide=datepicker]').each (index, dateField) ->
83
+
84
+ $(dateField).datepicker().on 'hide', (event) ->
85
+ $self = $(event.currentTarget)
86
+
87
+ eventToTriggerOnChange = $self.data('close-calendar-event-name')
88
+
89
+ if eventToTriggerOnChange
90
+ $self.trigger(eventToTriggerOnChange)
91
+
92
+ else if $self.attr('id').split('_').pop() == 'fr'
93
+ $to = $self.parent().next().find('input:text.check-for-bsdatepicker')
94
+ if $to.length > 0
95
+ $to.datepicker 'show'
96
+
97
+
98
+ setupJqueryUiDatepicker = ->
99
+ # check jquery ui datepickeer
100
+ unless $.datepicker
101
+ alert """Seems like you do not have jQuery datepicker (http://jqueryui.com/demos/datepicker/)
102
+ installed. Either install it pick another filter with :filter_type.
103
+ """
104
+ # setting up the locale for datepicker
105
+ if locale = $('.date-filter.wg-jquery-datepicker input[type=hidden]').data('locale')
106
+ $.datepicker.setDefaults($.datepicker.regional[locale]);
107
+
108
+
109
+ $('.date-filter.wg-jquery-datepicker .date-label').each (index, removeLink) ->
110
+ datepickerHiddenField = $('#' + $(removeLink).data('dom-id'))
111
+
112
+ eventToTriggerOnChange = datepickerHiddenField.data('close-calendar-event-name')
113
+
114
+ # setting up the remove link for datepicker
115
+ $(removeLink).click (event) ->
116
+ $(this).html('')
117
+ datepickerHiddenField.val('')
118
+ if eventToTriggerOnChange
119
+ datepickerHiddenField.trigger(eventToTriggerOnChange)
120
+ event.preventDefault()
121
+ false
122
+ that = this
123
+
124
+ dateFormat = datepickerHiddenField.data('date-format')
125
+
126
+ yearRange = datepickerHiddenField.data('date-year-range')
127
+
128
+ labelText = datepickerHiddenField.data('button-text')
129
+
130
+ # datepicker constructor
131
+ datepickerHiddenField.datepicker
132
+ firstDay: 1
133
+ dateFormat: dateFormat
134
+ changeMonth: true
135
+ changeYear: true
136
+ yearRange: yearRange
137
+
138
+ onSelect: (dateText, inst) ->
139
+
140
+ selectedDate = $(this).datepicker("getDate")
141
+
142
+ moveDateBoundIfInvalidPeriod(
143
+ 'the-other-datepicker-id-to',
144
+ datepickerHiddenField,
145
+ selectedDate,
146
+ dateFormat,
147
+ (theOther, selected)-> theOther < selected
148
+ )
149
+
150
+ moveDateBoundIfInvalidPeriod(
151
+ 'the-other-datepicker-id-from',
152
+ datepickerHiddenField,
153
+ selectedDate,
154
+ dateFormat,
155
+ (theOther, selected)-> theOther > selected
156
+ )
157
+
158
+ $(that).html(dateText)
159
+ if eventToTriggerOnChange
160
+ datepickerHiddenField.trigger(eventToTriggerOnChange)
161
+
162
+ datepickerContainer = datepickerHiddenField.parent()
163
+
164
+ $(removeLink).before(" <i class=\"fa fa-calendar ui-datepicker-trigger\" title=\"#{labelText}\" ></i> ")
165
+
166
+ newlyAdded = $('.fa-calendar', datepickerContainer)
167
+
168
+ newlyAdded.click ->
169
+
170
+ datepickerHiddenField.datepicker("show")
171
+
172
+
173
+ # hiding and showing the row with filters
174
+ setupHidingShowingOfFilterRow = (wiceGridContainer) ->
175
+ hideFilter = '.wg-hide-filter'
176
+ showFilter = '.wg-show-filter'
177
+ filterRow = '.wg-filter-row'
178
+
179
+ $(hideFilter, wiceGridContainer).click ->
180
+ $(this).hide()
181
+ $(showFilter, wiceGridContainer).show()
182
+ $(filterRow, wiceGridContainer).hide()
183
+
184
+ $(showFilter, wiceGridContainer).click ->
185
+ $(this).hide()
186
+ $(hideFilter, wiceGridContainer).show()
187
+ $(filterRow, wiceGridContainer).show()
188
+
189
+
190
+ setupCsvExport = (wiceGridContainer, gridProcessor) ->
191
+ $('.export-to-csv-button', wiceGridContainer).click ->
192
+ gridProcessor.exportToCsv()
193
+
194
+
195
+ # trigger submit/reset from within the grid
196
+ setupSubmitReset = (wiceGridContainer, gridProcessor) ->
197
+ $('.submit', wiceGridContainer).click ->
198
+ gridProcessor.process()
199
+
200
+ $('.reset', wiceGridContainer).click ->
201
+ gridProcessor.reset()
202
+
203
+ $('.wg-filter-row input[type=text], .wg-filter-row input:text[data-provide=datepicker]', wiceGridContainer).keydown (event) ->
204
+ if event.keyCode == 13
205
+ event.preventDefault()
206
+ gridProcessor.process()
207
+
208
+
209
+ focusElementIfNeeded = (focusId) ->
210
+ elements = $('#' + focusId)
211
+ if elToFocus = elements[0]
212
+ elToFocus.value = elToFocus.value
213
+ elToFocus.focus()
214
+
215
+
216
+ # autoreload for internal filters
217
+ setupAutoreloadsForInternalFilters = (wiceGridContainer, gridProcessor) ->
218
+ $('select.auto-reload, input.native-datepicker.auto-reload', wiceGridContainer).change ->
219
+ gridProcessor.process()
220
+
221
+ $('input.auto-reload', wiceGridContainer).keyup (event)->
222
+ if isKeySignificant event.which
223
+ gridProcessor.setProcessTimer(this.id)
224
+
225
+ $('input.negation-checkbox.auto-reload', wiceGridContainer).click ->
226
+ gridProcessor.process()
227
+
228
+ $(document).bind 'wg:calendarChanged_' + gridProcessor.name, ->
229
+ gridProcessor.process()
230
+
231
+
232
+
233
+ isKeySignificant = (keyCode, func)->
234
+ [37, 38, 39, 40, 9, 27].indexOf(keyCode) == -1
235
+
236
+ # autoreload for internal filters
237
+ setupAutoreloadsForExternalFilters = ->
238
+
239
+ $('.wg-detached-filter').each (index, detachedFilterContainer) ->
240
+ gridProcessor = getGridProcessorForElement(detachedFilterContainer)
241
+ if gridProcessor
242
+ $('select.auto-reload, input.native-datepicker.auto-reload', detachedFilterContainer).change ->
243
+ gridProcessor.process()
244
+
245
+ $('input.auto-reload', detachedFilterContainer).keyup (event)->
246
+ if isKeySignificant event.which
247
+ gridProcessor.setProcessTimer(this.id)
248
+
249
+ $('input.negation-checkbox.auto-reload', detachedFilterContainer).click ->
250
+ gridProcessor.process()
251
+
252
+
253
+ # trigger the all records mode
254
+ setupShowingAllRecords = (wiceGridContainer, gridProcessor) ->
255
+ $('.wg-show-all-link, .wg-back-to-pagination-link', wiceGridContainer).click (event) ->
256
+ event.preventDefault()
257
+ gridState = $(this).data("grid-state")
258
+ confirmationMessage = $(this).data("confim-message")
259
+ reloadGrid = ->
260
+ gridProcessor.reloadPageForGivenGridState gridState
261
+ if confirmationMessage
262
+ if confirm(confirmationMessage)
263
+ reloadGrid()
264
+ else
265
+ reloadGrid()
266
+
267
+ # dropdown filter multiselect
268
+ setupMultiSelectToggle = (wiceGridContainer)->
269
+ $('.expand-multi-select-icon', wiceGridContainer).click ->
270
+ $(this).prev().each (index, select) ->
271
+ select.multiple = true
272
+ $(this).next().show()
273
+ $(this).hide()
274
+
275
+ $('.collapse-multi-select-icon', wiceGridContainer).click ->
276
+ $(this).prev().prev().each (index, select) ->
277
+ select.multiple = false
278
+ $(this).prev().show()
279
+ $(this).hide()
280
+
281
+
282
+ setupBulkToggleForActionColumn = (wiceGridContainer) ->
283
+ $('.select-all', wiceGridContainer).click ->
284
+ $('.sel input', wiceGridContainer).prop('checked', true).trigger('change')
285
+
286
+ $('.deselect-all', wiceGridContainer).click ->
287
+ $('.sel input', wiceGridContainer).prop('checked', false).trigger('change')
288
+
289
+ $('.wg-select-all', wiceGridContainer).click ->
290
+ $('.sel input', wiceGridContainer).prop('checked', $(this).prop('checked')).trigger('change')
291
+
292
+
293
+ getGridProcessorForElement = (element) ->
294
+ gridName = $(element).data('grid-name')
295
+ if gridName && window[globalVarForAllGrids]
296
+ window[globalVarForAllGrids][gridName]
297
+ else
298
+ null
299
+
300
+
301
+ setupExternalCsvExport = ->
302
+
303
+ $(".wg-external-csv-export-button").each (index, externalCsvExportButton) ->
304
+ gridProcessor = getGridProcessorForElement(externalCsvExportButton)
305
+ if gridProcessor
306
+ $(externalCsvExportButton).click (event) ->
307
+ gridProcessor.exportToCsv()
308
+
309
+
310
+ setupExternalSubmitReset = ->
311
+
312
+ $(".wg-external-submit-button").each (index, externalSubmitButton) ->
313
+ gridProcessor = getGridProcessorForElement(externalSubmitButton)
314
+ if gridProcessor
315
+ $(externalSubmitButton).click (event) ->
316
+ gridProcessor.process()
317
+ event.preventDefault()
318
+ false
319
+
320
+ $(".wg-external-reset-button").each (index, externalResetButton) ->
321
+ gridProcessor = getGridProcessorForElement(externalResetButton)
322
+ if gridProcessor
323
+ $(externalResetButton).click (event) ->
324
+ gridProcessor.reset()
325
+ event.preventDefault()
326
+ false
327
+
328
+
329
+ $('.wg-detached-filter').each (index, detachedFilterContainer) ->
330
+ gridProcessor = getGridProcessorForElement(detachedFilterContainer)
331
+ if gridProcessor
332
+ $('input[type=text], input:text[data-provide=datepicker]', this).keydown (event) ->
333
+ if event.keyCode == 13
334
+ gridProcessor.process()
335
+ event.preventDefault()
336
+ false
337
+
338
+ window['getGridProcessorForElement'] = getGridProcessorForElement
339
+ window['initWiceGrid'] = initWiceGrid