wice_grid 4.1.0 → 6.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +63 -36
- data/.github/dependabot.yml +36 -0
- data/CHANGELOG.md +14 -7
- data/Gemfile.lock +68 -47
- data/README.md +10 -13
- data/config/locales/cz.yml +2 -5
- data/config/locales/de.yml +0 -5
- data/config/locales/en.yml +0 -5
- data/config/locales/es.yml +0 -5
- data/config/locales/fr.yml +2 -5
- data/config/locales/is.yml +4 -8
- data/config/locales/it.yml +0 -5
- data/config/locales/ja.yml +0 -5
- data/config/locales/nl.yml +2 -5
- data/config/locales/pt-BR.yml +2 -5
- data/config/locales/pt.yml +2 -5
- data/config/locales/ru.yml +2 -5
- data/config/locales/sk.yml +2 -5
- data/config/locales/uk.yml +2 -5
- data/config/locales/zh.yml +2 -5
- data/gemfiles/rails_5.0.gemfile.lock +34 -26
- data/gemfiles/rails_5.1.gemfile.lock +35 -27
- data/gemfiles/rails_5.2.gemfile.lock +37 -29
- data/lib/wice/active_record_column_wrapper.rb +10 -0
- data/lib/wice/columns/column_custom_dropdown.rb +14 -4
- data/lib/wice/grid_renderer.rb +3 -3
- data/lib/wice/table_column_matrix.rb +2 -1
- data/lib/wice/wice_grid_controller.rb +1 -51
- data/lib/wice_grid.rb +1 -1
- data/package.json +18 -0
- data/spec/acceptance_helper.rb +1 -0
- data/spec/features/auto_reloads2_request_spec.rb +18 -1
- data/spec/features/auto_reloads_request_spec.rb +19 -3
- data/spec/features/custom_filters1_request_spec.rb +5 -24
- data/spec/features/custom_filters2_request_spec.rb +4 -26
- data/spec/features/custom_filters3_request_spec.rb +3 -19
- data/spec/features/detached_filters_spec.rb +1 -1
- data/spec/features/detached_filters_two_grids_spec.rb +10 -2
- data/spec/features/shared_detached_filters.rb +18 -1
- data/vendor/assets/javascripts/wice_grid_processor.js.coffee +3 -3
- data/wice_grid.gemspec +14 -12
- metadata +56 -36
- data/.travis.yml +0 -22
- data/TODO.md +0 -16
data/config/locales/uk.yml
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
uk:
|
2
|
-
date:
|
3
|
-
order:
|
4
|
-
- :year
|
5
|
-
- :month
|
6
|
-
- :day
|
7
2
|
wice_grid:
|
8
3
|
show_filter_tooltip: "Показати фільтр"
|
9
4
|
hide_filter_tooltip: "Сховати фільтр"
|
@@ -43,3 +38,5 @@ uk:
|
|
43
38
|
query_saved_message: "Збережуваний фільтр збережено."
|
44
39
|
select_all: "Виділити все"
|
45
40
|
deselect_all: "Забрати виділення"
|
41
|
+
expand: Розгорнути
|
42
|
+
collapse: Згорнути
|
data/config/locales/zh.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
wice_grid (4.0
|
4
|
+
wice_grid (4.1.0)
|
5
5
|
coffee-rails (> 3.2)
|
6
|
-
kaminari (~>
|
6
|
+
kaminari (~> 1.1)
|
7
7
|
rails (~> 5.0, < 5.3)
|
8
8
|
|
9
9
|
GEM
|
@@ -57,12 +57,14 @@ GEM
|
|
57
57
|
sass (~> 3.2)
|
58
58
|
builder (3.2.3)
|
59
59
|
byebug (10.0.2)
|
60
|
-
capybara (
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
rack
|
65
|
-
|
60
|
+
capybara (3.13.2)
|
61
|
+
addressable
|
62
|
+
mini_mime (>= 0.1.3)
|
63
|
+
nokogiri (~> 1.8)
|
64
|
+
rack (>= 1.6.0)
|
65
|
+
rack-test (>= 0.6.3)
|
66
|
+
regexp_parser (~> 1.2)
|
67
|
+
xpath (~> 3.2)
|
66
68
|
capybara-screenshot (1.0.21)
|
67
69
|
capybara (>= 1.0, < 4)
|
68
70
|
launchy
|
@@ -111,9 +113,18 @@ GEM
|
|
111
113
|
jquery-ui-themes (0.0.12)
|
112
114
|
httparty
|
113
115
|
json (1.8.6)
|
114
|
-
kaminari (
|
115
|
-
|
116
|
-
|
116
|
+
kaminari (1.1.1)
|
117
|
+
activesupport (>= 4.1.0)
|
118
|
+
kaminari-actionview (= 1.1.1)
|
119
|
+
kaminari-activerecord (= 1.1.1)
|
120
|
+
kaminari-core (= 1.1.1)
|
121
|
+
kaminari-actionview (1.1.1)
|
122
|
+
actionview
|
123
|
+
kaminari-core (= 1.1.1)
|
124
|
+
kaminari-activerecord (1.1.1)
|
125
|
+
activerecord
|
126
|
+
kaminari-core (= 1.1.1)
|
127
|
+
kaminari-core (1.1.1)
|
117
128
|
launchy (2.4.3)
|
118
129
|
addressable (~> 2.3)
|
119
130
|
libv8 (3.16.14.19)
|
@@ -123,27 +134,23 @@ GEM
|
|
123
134
|
mail (2.7.0)
|
124
135
|
mini_mime (>= 0.1.1)
|
125
136
|
method_source (0.9.0)
|
126
|
-
mime-types (3.1)
|
127
|
-
mime-types-data (~> 3.2015)
|
128
|
-
mime-types-data (3.2016.0521)
|
129
137
|
mini_mime (1.0.0)
|
130
|
-
mini_portile2 (2.
|
138
|
+
mini_portile2 (2.4.0)
|
131
139
|
minitest (5.11.3)
|
132
140
|
multi_json (1.13.1)
|
133
141
|
multi_xml (0.6.0)
|
134
142
|
nio4r (2.3.1)
|
135
|
-
nokogiri (1.
|
136
|
-
mini_portile2 (~> 2.
|
137
|
-
poltergeist (1.
|
138
|
-
capybara (
|
143
|
+
nokogiri (1.10.1)
|
144
|
+
mini_portile2 (~> 2.4.0)
|
145
|
+
poltergeist (1.18.1)
|
146
|
+
capybara (>= 2.1, < 4)
|
139
147
|
cliver (~> 0.3.1)
|
140
|
-
multi_json (~> 1.0)
|
141
148
|
websocket-driver (>= 0.2.0)
|
142
149
|
pry (0.11.3)
|
143
150
|
coderay (~> 1.1.0)
|
144
151
|
method_source (~> 0.9.0)
|
145
152
|
public_suffix (3.0.2)
|
146
|
-
rack (2.0.
|
153
|
+
rack (2.0.6)
|
147
154
|
rack-test (0.6.3)
|
148
155
|
rack (>= 1.0)
|
149
156
|
rails (5.0.7)
|
@@ -176,6 +183,7 @@ GEM
|
|
176
183
|
rdoc (4.2.2)
|
177
184
|
json (~> 1.4)
|
178
185
|
ref (2.0.0)
|
186
|
+
regexp_parser (1.3.0)
|
179
187
|
rspec (3.6.0)
|
180
188
|
rspec-core (~> 3.6.0)
|
181
189
|
rspec-expectations (~> 3.6.0)
|
@@ -249,8 +257,8 @@ GEM
|
|
249
257
|
websocket-driver (0.6.5)
|
250
258
|
websocket-extensions (>= 0.1.0)
|
251
259
|
websocket-extensions (0.1.3)
|
252
|
-
xpath (2.
|
253
|
-
nokogiri (~> 1.
|
260
|
+
xpath (3.2.0)
|
261
|
+
nokogiri (~> 1.8)
|
254
262
|
yard (0.8.7.6)
|
255
263
|
|
256
264
|
PLATFORMS
|
@@ -261,7 +269,7 @@ DEPENDENCIES
|
|
261
269
|
bootstrap-sass (= 3.1.1.1)
|
262
270
|
bundler (~> 1.3)
|
263
271
|
byebug
|
264
|
-
capybara (~>
|
272
|
+
capybara (~> 3.13.2)
|
265
273
|
capybara-screenshot (~> 1.0.11)
|
266
274
|
coderay (~> 1.1.0)
|
267
275
|
faker (~> 1.8.7)
|
@@ -271,7 +279,7 @@ DEPENDENCIES
|
|
271
279
|
jquery-rails (~> 4.3.3)
|
272
280
|
jquery-ui-rails (~> 5.0.5)
|
273
281
|
jquery-ui-themes (~> 0.0.11)
|
274
|
-
poltergeist (~> 1.
|
282
|
+
poltergeist (~> 1.18.0)
|
275
283
|
rails (~> 5.0.0)
|
276
284
|
rake (~> 10.1)
|
277
285
|
rdoc (~> 4.2.0)
|
@@ -288,4 +296,4 @@ DEPENDENCIES
|
|
288
296
|
yard (~> 0.8)
|
289
297
|
|
290
298
|
BUNDLED WITH
|
291
|
-
1.
|
299
|
+
1.17.2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
wice_grid (4.0
|
4
|
+
wice_grid (4.1.0)
|
5
5
|
coffee-rails (> 3.2)
|
6
|
-
kaminari (~>
|
6
|
+
kaminari (~> 1.1)
|
7
7
|
rails (~> 5.0, < 5.3)
|
8
8
|
|
9
9
|
GEM
|
@@ -57,12 +57,14 @@ GEM
|
|
57
57
|
sass (~> 3.2)
|
58
58
|
builder (3.2.3)
|
59
59
|
byebug (10.0.2)
|
60
|
-
capybara (
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
rack
|
65
|
-
|
60
|
+
capybara (3.13.2)
|
61
|
+
addressable
|
62
|
+
mini_mime (>= 0.1.3)
|
63
|
+
nokogiri (~> 1.8)
|
64
|
+
rack (>= 1.6.0)
|
65
|
+
rack-test (>= 0.6.3)
|
66
|
+
regexp_parser (~> 1.2)
|
67
|
+
xpath (~> 3.2)
|
66
68
|
capybara-screenshot (1.0.21)
|
67
69
|
capybara (>= 1.0, < 4)
|
68
70
|
launchy
|
@@ -111,9 +113,18 @@ GEM
|
|
111
113
|
jquery-ui-themes (0.0.12)
|
112
114
|
httparty
|
113
115
|
json (1.8.6)
|
114
|
-
kaminari (
|
115
|
-
|
116
|
-
|
116
|
+
kaminari (1.1.1)
|
117
|
+
activesupport (>= 4.1.0)
|
118
|
+
kaminari-actionview (= 1.1.1)
|
119
|
+
kaminari-activerecord (= 1.1.1)
|
120
|
+
kaminari-core (= 1.1.1)
|
121
|
+
kaminari-actionview (1.1.1)
|
122
|
+
actionview
|
123
|
+
kaminari-core (= 1.1.1)
|
124
|
+
kaminari-activerecord (1.1.1)
|
125
|
+
activerecord
|
126
|
+
kaminari-core (= 1.1.1)
|
127
|
+
kaminari-core (1.1.1)
|
117
128
|
launchy (2.4.3)
|
118
129
|
addressable (~> 2.3)
|
119
130
|
libv8 (3.16.14.19)
|
@@ -123,28 +134,24 @@ GEM
|
|
123
134
|
mail (2.7.0)
|
124
135
|
mini_mime (>= 0.1.1)
|
125
136
|
method_source (0.9.0)
|
126
|
-
mime-types (3.1)
|
127
|
-
mime-types-data (~> 3.2015)
|
128
|
-
mime-types-data (3.2016.0521)
|
129
137
|
mini_mime (1.0.0)
|
130
|
-
mini_portile2 (2.
|
138
|
+
mini_portile2 (2.4.0)
|
131
139
|
minitest (5.11.3)
|
132
140
|
multi_json (1.13.1)
|
133
141
|
multi_xml (0.6.0)
|
134
142
|
nio4r (2.3.1)
|
135
|
-
nokogiri (1.
|
136
|
-
mini_portile2 (~> 2.
|
137
|
-
poltergeist (1.
|
138
|
-
capybara (
|
143
|
+
nokogiri (1.10.1)
|
144
|
+
mini_portile2 (~> 2.4.0)
|
145
|
+
poltergeist (1.18.1)
|
146
|
+
capybara (>= 2.1, < 4)
|
139
147
|
cliver (~> 0.3.1)
|
140
|
-
multi_json (~> 1.0)
|
141
148
|
websocket-driver (>= 0.2.0)
|
142
149
|
pry (0.11.3)
|
143
150
|
coderay (~> 1.1.0)
|
144
151
|
method_source (~> 0.9.0)
|
145
152
|
public_suffix (3.0.2)
|
146
|
-
rack (2.0.
|
147
|
-
rack-test (1.
|
153
|
+
rack (2.0.6)
|
154
|
+
rack-test (1.1.0)
|
148
155
|
rack (>= 1.0, < 3)
|
149
156
|
rails (5.1.6)
|
150
157
|
actioncable (= 5.1.6)
|
@@ -176,6 +183,7 @@ GEM
|
|
176
183
|
rdoc (4.2.2)
|
177
184
|
json (~> 1.4)
|
178
185
|
ref (2.0.0)
|
186
|
+
regexp_parser (1.3.0)
|
179
187
|
rspec (3.6.0)
|
180
188
|
rspec-core (~> 3.6.0)
|
181
189
|
rspec-expectations (~> 3.6.0)
|
@@ -249,8 +257,8 @@ GEM
|
|
249
257
|
websocket-driver (0.6.5)
|
250
258
|
websocket-extensions (>= 0.1.0)
|
251
259
|
websocket-extensions (0.1.3)
|
252
|
-
xpath (2.
|
253
|
-
nokogiri (~> 1.
|
260
|
+
xpath (3.2.0)
|
261
|
+
nokogiri (~> 1.8)
|
254
262
|
yard (0.8.7.6)
|
255
263
|
|
256
264
|
PLATFORMS
|
@@ -261,7 +269,7 @@ DEPENDENCIES
|
|
261
269
|
bootstrap-sass (= 3.1.1.1)
|
262
270
|
bundler (~> 1.3)
|
263
271
|
byebug
|
264
|
-
capybara (~>
|
272
|
+
capybara (~> 3.13.2)
|
265
273
|
capybara-screenshot (~> 1.0.11)
|
266
274
|
coderay (~> 1.1.0)
|
267
275
|
faker (~> 1.8.7)
|
@@ -271,7 +279,7 @@ DEPENDENCIES
|
|
271
279
|
jquery-rails (~> 4.3.3)
|
272
280
|
jquery-ui-rails (~> 5.0.5)
|
273
281
|
jquery-ui-themes (~> 0.0.11)
|
274
|
-
poltergeist (~> 1.
|
282
|
+
poltergeist (~> 1.18.0)
|
275
283
|
rails (~> 5.1.0)
|
276
284
|
rake (~> 10.1)
|
277
285
|
rdoc (~> 4.2.0)
|
@@ -288,4 +296,4 @@ DEPENDENCIES
|
|
288
296
|
yard (~> 0.8)
|
289
297
|
|
290
298
|
BUNDLED WITH
|
291
|
-
1.
|
299
|
+
1.17.2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
wice_grid (4.0
|
4
|
+
wice_grid (4.1.0)
|
5
5
|
coffee-rails (> 3.2)
|
6
|
-
kaminari (~>
|
6
|
+
kaminari (~> 1.1)
|
7
7
|
rails (~> 5.0, < 5.3)
|
8
8
|
|
9
9
|
GEM
|
@@ -61,12 +61,14 @@ GEM
|
|
61
61
|
sass (~> 3.2)
|
62
62
|
builder (3.2.3)
|
63
63
|
byebug (10.0.2)
|
64
|
-
capybara (
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
rack
|
69
|
-
|
64
|
+
capybara (3.13.2)
|
65
|
+
addressable
|
66
|
+
mini_mime (>= 0.1.3)
|
67
|
+
nokogiri (~> 1.8)
|
68
|
+
rack (>= 1.6.0)
|
69
|
+
rack-test (>= 0.6.3)
|
70
|
+
regexp_parser (~> 1.2)
|
71
|
+
xpath (~> 3.2)
|
70
72
|
capybara-screenshot (1.0.21)
|
71
73
|
capybara (>= 1.0, < 4)
|
72
74
|
launchy
|
@@ -74,9 +76,9 @@ GEM
|
|
74
76
|
ffi (~> 1.0, >= 1.0.11)
|
75
77
|
cliver (0.3.2)
|
76
78
|
coderay (1.1.2)
|
77
|
-
coffee-rails (
|
79
|
+
coffee-rails (5.0.0)
|
78
80
|
coffee-script (>= 2.2.0)
|
79
|
-
railties (>=
|
81
|
+
railties (>= 5.2.0)
|
80
82
|
coffee-script (2.4.1)
|
81
83
|
coffee-script-source
|
82
84
|
execjs
|
@@ -115,9 +117,18 @@ GEM
|
|
115
117
|
jquery-ui-themes (0.0.12)
|
116
118
|
httparty
|
117
119
|
json (1.8.6)
|
118
|
-
kaminari (
|
119
|
-
|
120
|
-
|
120
|
+
kaminari (1.1.1)
|
121
|
+
activesupport (>= 4.1.0)
|
122
|
+
kaminari-actionview (= 1.1.1)
|
123
|
+
kaminari-activerecord (= 1.1.1)
|
124
|
+
kaminari-core (= 1.1.1)
|
125
|
+
kaminari-actionview (1.1.1)
|
126
|
+
actionview
|
127
|
+
kaminari-core (= 1.1.1)
|
128
|
+
kaminari-activerecord (1.1.1)
|
129
|
+
activerecord
|
130
|
+
kaminari-core (= 1.1.1)
|
131
|
+
kaminari-core (1.1.1)
|
121
132
|
launchy (2.4.3)
|
122
133
|
addressable (~> 2.3)
|
123
134
|
libv8 (3.16.14.19)
|
@@ -129,29 +140,25 @@ GEM
|
|
129
140
|
marcel (0.3.2)
|
130
141
|
mimemagic (~> 0.3.2)
|
131
142
|
method_source (0.9.0)
|
132
|
-
mime-types (3.1)
|
133
|
-
mime-types-data (~> 3.2015)
|
134
|
-
mime-types-data (3.2016.0521)
|
135
143
|
mimemagic (0.3.2)
|
136
144
|
mini_mime (1.0.0)
|
137
|
-
mini_portile2 (2.
|
145
|
+
mini_portile2 (2.4.0)
|
138
146
|
minitest (5.11.3)
|
139
147
|
multi_json (1.13.1)
|
140
148
|
multi_xml (0.6.0)
|
141
149
|
nio4r (2.3.1)
|
142
|
-
nokogiri (1.
|
143
|
-
mini_portile2 (~> 2.
|
144
|
-
poltergeist (1.
|
145
|
-
capybara (
|
150
|
+
nokogiri (1.10.1)
|
151
|
+
mini_portile2 (~> 2.4.0)
|
152
|
+
poltergeist (1.18.1)
|
153
|
+
capybara (>= 2.1, < 4)
|
146
154
|
cliver (~> 0.3.1)
|
147
|
-
multi_json (~> 1.0)
|
148
155
|
websocket-driver (>= 0.2.0)
|
149
156
|
pry (0.11.3)
|
150
157
|
coderay (~> 1.1.0)
|
151
158
|
method_source (~> 0.9.0)
|
152
159
|
public_suffix (3.0.2)
|
153
|
-
rack (2.0.
|
154
|
-
rack-test (1.
|
160
|
+
rack (2.0.6)
|
161
|
+
rack-test (1.1.0)
|
155
162
|
rack (>= 1.0, < 3)
|
156
163
|
rails (5.2.0)
|
157
164
|
actioncable (= 5.2.0)
|
@@ -184,6 +191,7 @@ GEM
|
|
184
191
|
rdoc (4.2.2)
|
185
192
|
json (~> 1.4)
|
186
193
|
ref (2.0.0)
|
194
|
+
regexp_parser (1.3.0)
|
187
195
|
rspec (3.6.0)
|
188
196
|
rspec-core (~> 3.6.0)
|
189
197
|
rspec-expectations (~> 3.6.0)
|
@@ -257,8 +265,8 @@ GEM
|
|
257
265
|
websocket-driver (0.7.0)
|
258
266
|
websocket-extensions (>= 0.1.0)
|
259
267
|
websocket-extensions (0.1.3)
|
260
|
-
xpath (2.
|
261
|
-
nokogiri (~> 1.
|
268
|
+
xpath (3.2.0)
|
269
|
+
nokogiri (~> 1.8)
|
262
270
|
yard (0.8.7.6)
|
263
271
|
|
264
272
|
PLATFORMS
|
@@ -269,7 +277,7 @@ DEPENDENCIES
|
|
269
277
|
bootstrap-sass (= 3.1.1.1)
|
270
278
|
bundler (~> 1.3)
|
271
279
|
byebug
|
272
|
-
capybara (~>
|
280
|
+
capybara (~> 3.13.2)
|
273
281
|
capybara-screenshot (~> 1.0.11)
|
274
282
|
coderay (~> 1.1.0)
|
275
283
|
faker (~> 1.8.7)
|
@@ -279,7 +287,7 @@ DEPENDENCIES
|
|
279
287
|
jquery-rails (~> 4.3.3)
|
280
288
|
jquery-ui-rails (~> 5.0.5)
|
281
289
|
jquery-ui-themes (~> 0.0.11)
|
282
|
-
poltergeist (~> 1.
|
290
|
+
poltergeist (~> 1.18.0)
|
283
291
|
rails (~> 5.2.0)
|
284
292
|
rake (~> 10.1)
|
285
293
|
rdoc (~> 4.2.0)
|
@@ -296,4 +304,4 @@ DEPENDENCIES
|
|
296
304
|
yard (~> 0.8)
|
297
305
|
|
298
306
|
BUNDLED WITH
|
299
|
-
1.
|
307
|
+
1.17.2
|
@@ -115,6 +115,16 @@ module Wice
|
|
115
115
|
@column.model
|
116
116
|
end
|
117
117
|
|
118
|
+
def array?
|
119
|
+
if @column.sql_type_metadata.respond_to? :array
|
120
|
+
@column.sql_type_metadata.array
|
121
|
+
else
|
122
|
+
@column.sql_type_metadata.sql_type.index('[]')
|
123
|
+
end
|
124
|
+
rescue
|
125
|
+
false
|
126
|
+
end
|
127
|
+
|
118
128
|
def alias_or_table_name(table_alias) #:nodoc:
|
119
129
|
table_alias || @column.model.table_name
|
120
130
|
end
|
@@ -83,17 +83,23 @@ module Wice
|
|
83
83
|
end
|
84
84
|
opts = (opts.is_a?(Array) && opts.size == 1) ? opts[0] : opts
|
85
85
|
|
86
|
+
column_name =
|
87
|
+
"#{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name}"
|
86
88
|
if opts.is_a?(Array)
|
87
89
|
opts_with_special_values, normal_opts = opts.partition { |v| ::Wice::GridTools.special_value(v) }
|
88
90
|
|
89
91
|
conditions_ar = if normal_opts.size > 0
|
90
|
-
|
92
|
+
if @column_wrapper.array?
|
93
|
+
[(["? = ANY(#{column_name})"] * normal_opts.size).join(' OR ')] + normal_opts
|
94
|
+
else
|
95
|
+
[" #{column_name} IN ( " + (['?'] * normal_opts.size).join(', ') + ' )'] + normal_opts
|
96
|
+
end
|
91
97
|
else
|
92
98
|
[]
|
93
99
|
end
|
94
100
|
|
95
101
|
if opts_with_special_values.size > 0
|
96
|
-
special_conditions = opts_with_special_values.collect { |v| " #{
|
102
|
+
special_conditions = opts_with_special_values.collect { |v| " #{column_name} is " + v }.join(' or ')
|
97
103
|
if conditions_ar.size > 0
|
98
104
|
conditions_ar[0] = " (#{conditions_ar[0]} or #{special_conditions} ) "
|
99
105
|
else
|
@@ -103,9 +109,13 @@ module Wice
|
|
103
109
|
conditions_ar
|
104
110
|
else
|
105
111
|
if ::Wice::GridTools.special_value(opts)
|
106
|
-
" #{
|
112
|
+
" #{column_name} is " + opts
|
107
113
|
else
|
108
|
-
|
114
|
+
if @column_wrapper.array?
|
115
|
+
[" ? = ANY(#{column_name})", opts]
|
116
|
+
else
|
117
|
+
[" #{column_name} = ?", opts]
|
118
|
+
end
|
109
119
|
end
|
110
120
|
end
|
111
121
|
end
|
data/lib/wice/grid_renderer.rb
CHANGED
@@ -106,7 +106,7 @@ module Wice
|
|
106
106
|
def csv_export_icon #:nodoc:
|
107
107
|
content_tag(
|
108
108
|
:div,
|
109
|
-
content_tag(:i, '', class: 'fa fa-file-
|
109
|
+
content_tag(:i, '', class: 'fa fa-file-csv'),
|
110
110
|
title: NlMessage['csv_export_tooltip'],
|
111
111
|
class: 'clickable export-to-csv-button'
|
112
112
|
)
|
@@ -119,13 +119,13 @@ module Wice
|
|
119
119
|
|
120
120
|
if panel.nil?
|
121
121
|
if render_csv_button
|
122
|
-
"<tr><td colspan=\"#{number_of_columns}\"></td><td>#{csv_export_icon}</td></tr>"
|
122
|
+
"<tr><td colspan=\"#{number_of_columns}\"></td><td class=\"csv_export\">#{csv_export_icon}</td></tr>"
|
123
123
|
else
|
124
124
|
''
|
125
125
|
end
|
126
126
|
else
|
127
127
|
if render_csv_button
|
128
|
-
"<tr><td colspan=\"#{number_of_columns}\">#{panel}</td><td>#{csv_export_icon}</td></tr>"
|
128
|
+
"<tr><td colspan=\"#{number_of_columns}\">#{panel}</td><td class=\"csv_export\">#{csv_export_icon}</td></tr>"
|
129
129
|
else
|
130
130
|
"<tr><td colspan=\"#{number_of_columns + 1}\">#{panel}</td></tr>"
|
131
131
|
end
|
@@ -54,7 +54,8 @@ module Wice
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def init_columns_of_table(model) #:nodoc:
|
57
|
-
self[model] =
|
57
|
+
self[model] =
|
58
|
+
HashWithIndifferentAccess.new(model.columns.map(&:dup).index_by(&:name))
|
58
59
|
@by_table_names[model.table_name] = self[model]
|
59
60
|
self[model].each_value { |c| c.model = model }
|
60
61
|
end
|
@@ -115,7 +115,7 @@ module Wice
|
|
115
115
|
temp_filename = temp_filename.strip
|
116
116
|
filename = (grid.csv_file_name || grid.name) + '.csv'
|
117
117
|
grid.csv_tempfile.close
|
118
|
-
|
118
|
+
send_file temp_filename, filename: filename, type: "text/csv; charset=#{get_output_encoding grid.csv_encoding}"
|
119
119
|
grid.csv_tempfile = nil
|
120
120
|
true
|
121
121
|
else
|
@@ -170,55 +170,5 @@ module Wice
|
|
170
170
|
csv_encoding.split(':').first
|
171
171
|
end
|
172
172
|
end
|
173
|
-
|
174
|
-
def send_file_rails2(path, options = {}) #:nodoc:
|
175
|
-
raise "Cannot read file #{path}" unless File.file?(path) && File.readable?(path)
|
176
|
-
|
177
|
-
options[:length] ||= File.size(path)
|
178
|
-
options[:filename] ||= File.basename(path) unless options[:url_based_filename]
|
179
|
-
send_file_headers_rails2! options
|
180
|
-
|
181
|
-
@performed_render = false
|
182
|
-
|
183
|
-
logger.info "Sending file #{path}" unless logger.nil?
|
184
|
-
File.open(path, 'rb') { |file| render status: options[:status], plain: file.read }
|
185
|
-
end
|
186
|
-
|
187
|
-
DEFAULT_SEND_FILE_OPTIONS_RAILS2 = { #:nodoc:
|
188
|
-
type: 'application/octet-stream'.freeze,
|
189
|
-
disposition: 'attachment'.freeze,
|
190
|
-
stream: true,
|
191
|
-
buffer_size: 4096,
|
192
|
-
x_sendfile: false
|
193
|
-
}.freeze
|
194
|
-
|
195
|
-
def send_file_headers_rails2!(options) #:nodoc:
|
196
|
-
options.update(DEFAULT_SEND_FILE_OPTIONS_RAILS2.merge(options))
|
197
|
-
[:length, :type, :disposition].each do |arg|
|
198
|
-
raise ArgumentError, ":#{arg} option required" if options[arg].nil?
|
199
|
-
end
|
200
|
-
|
201
|
-
disposition = options[:disposition].dup || 'attachment'
|
202
|
-
|
203
|
-
disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
|
204
|
-
|
205
|
-
content_type = options[:type]
|
206
|
-
content_type = content_type.to_s.strip # fixes a problem with extra '\r' with some browsers
|
207
|
-
|
208
|
-
headers.merge!(
|
209
|
-
'Content-Length' => options[:length].to_s,
|
210
|
-
'Content-Type' => content_type,
|
211
|
-
'Content-Disposition' => disposition,
|
212
|
-
'Content-Transfer-Encoding' => 'binary'
|
213
|
-
)
|
214
|
-
|
215
|
-
# Fix a problem with IE 6.0 on opening downloaded files:
|
216
|
-
# If Cache-Control: no-cache is set (which Rails does by default),
|
217
|
-
# IE removes the file it just downloaded from its cache immediately
|
218
|
-
# after it displays the "open/save" dialog, which means that if you
|
219
|
-
# hit "open" the file isn't there anymore when the application that
|
220
|
-
# is called for handling the download is run, so let's workaround that
|
221
|
-
headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'
|
222
|
-
end
|
223
173
|
end
|
224
174
|
end
|
data/lib/wice_grid.rb
CHANGED
@@ -304,7 +304,7 @@ module Wice
|
|
304
304
|
else
|
305
305
|
@ar_options[:order] = arel_column_reference(@status[:order])
|
306
306
|
end
|
307
|
-
if @ar_options[:order].is_a?(Arel::Attributes::Attribute)
|
307
|
+
if @ar_options[:order].is_a?(Arel::Attributes::Attribute) || @ar_options[:order].is_a?(Arel::Nodes::SqlLiteral)
|
308
308
|
if @status[:order_direction] == 'desc'
|
309
309
|
@ar_options[:order] = @ar_options[:order].desc
|
310
310
|
else
|
data/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "wice-grid",
|
3
|
+
"version": "4.1.0",
|
4
|
+
"description": "WiceGrid is a Rails grid plugin",
|
5
|
+
"main": "vendor/assets/javascripts/wice_grid.js",
|
6
|
+
"repository": {
|
7
|
+
"type": "git",
|
8
|
+
"url": "/home/dima/devel/github/wice_grid"
|
9
|
+
},
|
10
|
+
"author": "Dmitry Kulikov",
|
11
|
+
"license": "MIT",
|
12
|
+
"directories": {
|
13
|
+
"lib": "lib"
|
14
|
+
},
|
15
|
+
"scripts": {
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
17
|
+
}
|
18
|
+
}
|
data/spec/acceptance_helper.rb
CHANGED