wice_grid 3.4.2 → 3.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -116,7 +116,7 @@ module Wice
116
116
  temp_filename = temp_filename.strip
117
117
  filename = (grid.csv_file_name || grid.name ) + '.csv'
118
118
  grid.csv_tempfile.close
119
- send_file_rails2 temp_filename, :filename => filename, :type => 'text/csv'
119
+ send_file_rails2 temp_filename, :filename => filename, :type => 'text/csv; charset=utf-8'
120
120
  grid.csv_tempfile = nil
121
121
  true
122
122
  else
data/lib/wice_grid.rb CHANGED
@@ -260,7 +260,7 @@ module Wice
260
260
 
261
261
  # conditions processed
262
262
 
263
- if (! opts[:skip_ordering]) && @status[:order]
263
+ if (! opts[:skip_ordering]) && ! @status[:order].blank?
264
264
  @ar_options[:order] = add_custom_order_sql(complete_column_name(@status[:order]))
265
265
 
266
266
  @ar_options[:order] += ' ' + @status[:order_direction]
@@ -1,5 +1,7 @@
1
1
  $(document).on 'page:load ready', -> initWiceGrid()
2
2
 
3
+ globalVarForAllGrids = 'wiceGrids'
4
+
3
5
  initWiceGrid = ->
4
6
 
5
7
  $(".wice-grid-container").each (index, wiceGridContainer) ->
@@ -26,7 +28,10 @@ initWiceGrid = ->
26
28
  templates : filterDeclaration.declaration.templates
27
29
  ids : filterDeclaration.declaration.ids
28
30
 
29
- window[gridName] = gridProcessor
31
+ unless window[globalVarForAllGrids]
32
+ window[globalVarForAllGrids] = {}
33
+
34
+ window[globalVarForAllGrids][gridName] = gridProcessor
30
35
 
31
36
  setupDatepicker()
32
37
  setupSubmitReset wiceGridContainer, gridProcessor
@@ -177,8 +182,9 @@ setupAutoreloadsForInternalFilters = (wiceGridContainer, gridProcessor) ->
177
182
  $('select.auto-reload', wiceGridContainer).change ->
178
183
  gridProcessor.process()
179
184
 
180
- $('input.auto-reload', wiceGridContainer).keyup ->
181
- gridProcessor.setProcessTimer(this.id)
185
+ $('input.auto-reload', wiceGridContainer).keyup (event)->
186
+ if isKeySignificant event.which
187
+ gridProcessor.setProcessTimer(this.id)
182
188
 
183
189
  $('input.negation-checkbox.auto-reload', wiceGridContainer).click ->
184
190
  gridProcessor.process()
@@ -186,6 +192,11 @@ setupAutoreloadsForInternalFilters = (wiceGridContainer, gridProcessor) ->
186
192
  $(document).bind 'wg:calendarChanged_' + gridProcessor.name, ->
187
193
  gridProcessor.process()
188
194
 
195
+
196
+
197
+ isKeySignificant = (keyCode, func)->
198
+ [37, 38, 39, 40, 9, 27].indexOf(keyCode) == -1
199
+
189
200
  # autoreload for internal filters
190
201
  setupAutoreloadsForExternalFilters = ->
191
202
 
@@ -195,8 +206,9 @@ setupAutoreloadsForExternalFilters = ->
195
206
  $('select.auto-reload', detachedFilterContainer).change ->
196
207
  gridProcessor.process()
197
208
 
198
- $('input.auto-reload', detachedFilterContainer).keyup ->
199
- gridProcessor.setProcessTimer(this.id)
209
+ $('input.auto-reload', detachedFilterContainer).keyup (event)->
210
+ if isKeySignificant event.which
211
+ gridProcessor.setProcessTimer(this.id)
200
212
 
201
213
  $('input.negation-checkbox.auto-reload', detachedFilterContainer).click ->
202
214
  gridProcessor.process()
@@ -241,8 +253,8 @@ setupBulkToggleForActionColumn = (wiceGridContainer) ->
241
253
 
242
254
  getGridProcessorForElement = (element) ->
243
255
  gridName = $(element).data('grid-name')
244
- if gridName
245
- window[gridName]
256
+ if gridName && window[globalVarForAllGrids]
257
+ window[globalVarForAllGrids][gridName]
246
258
  else
247
259
  null
248
260
 
data/wice_grid.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wice_grid'
3
- s.version = '3.4.2'
3
+ s.version = '3.4.3'
4
4
  s.homepage = 'https://github.com/leikind/wice_grid'
5
- s.date = '2013-11-12'
5
+ s.date = '2014-05-05'
6
6
  s.summary = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.'
7
7
  s.description = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.' +
8
8
  'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wice_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2
5
- prerelease:
4
+ version: 3.4.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Yuri Leikind
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: kaminari
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.13.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.13.0
30
27
  description: A Rails grid plugin to create grids with sorting, pagination, and (automatically
@@ -75,6 +72,7 @@ files:
75
72
  - lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb
76
73
  - lib/wice/helpers/wice_grid_view_helpers.rb
77
74
  - lib/wice/kaminari_monkey_patching.rb
75
+ - lib/wice/memory_adapter.rb
78
76
  - lib/wice/table_column_matrix.rb
79
77
  - lib/wice/wice_grid_controller.rb
80
78
  - lib/wice/wice_grid_core_ext.rb
@@ -107,25 +105,24 @@ files:
107
105
  homepage: https://github.com/leikind/wice_grid
108
106
  licenses:
109
107
  - MIT
108
+ metadata: {}
110
109
  post_install_message:
111
110
  rdoc_options: []
112
111
  require_paths:
113
112
  - lib
114
113
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
114
  requirements:
117
- - - ! '>='
115
+ - - '>='
118
116
  - !ruby/object:Gem::Version
119
117
  version: '0'
120
118
  required_rubygems_version: !ruby/object:Gem::Requirement
121
- none: false
122
119
  requirements:
123
- - - ! '>='
120
+ - - '>='
124
121
  - !ruby/object:Gem::Version
125
122
  version: '0'
126
123
  requirements: []
127
124
  rubyforge_project:
128
- rubygems_version: 1.8.23
125
+ rubygems_version: 2.0.3
129
126
  signing_key:
130
127
  specification_version: 3
131
128
  summary: A Rails grid plugin to create grids with sorting, pagination, and (automatically