netzke-basepack 0.8.3 → 0.8.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +5 -3
- data/lib/netzke/basepack/version.rb +1 -1
- data/test/basepack_test_app/db/development.sqlite3 +0 -0
- data/test/basepack_test_app/db/test.sqlite3 +0 -0
- data/test/basepack_test_app/features/grid_filters.feature +16 -12
- data/test/basepack_test_app/log/development.log +48583 -0
- data/test/basepack_test_app/log/test.log +239464 -0
- data/test/basepack_test_app/tmp/cache/assets/C92/5A0/sprockets%2F39e75754782ee12179bf35c9a0971d80 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/C9F/750/sprockets%2F20ce3d64040a5d3a0a8883bd60754356 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/CC4/C00/sprockets%2Fc615df52887d8c2e67e8413576a419c5 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/D0E/870/sprockets%2Fa593bf4fac106add88c9434141a49663 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/D14/8E0/sprockets%2F20748e8d1d7d090d122904a9fe6f18fc +0 -0
- data/test/basepack_test_app/tmp/cache/assets/D3E/DA0/sprockets%2Fa175f1ac5996544b908ba3ba3f64c4f3 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/D43/C00/sprockets%2F7bc60c758776356d615ab5edff201ee2 +0 -0
- data/test/basepack_test_app/tmp/cache/assets/D98/9C0/sprockets%2F18b80e8fe200aebc522e561a867ea6fb +0 -0
- data/test/basepack_test_app/tmp/cache/assets/DB0/6E0/sprockets%2F03e33f5a4779eeb48bcfc86ee717fb55 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c6fa2322cb559185c96b7c94bc81b5ac2659c11
|
4
|
+
data.tar.gz: 81749e01b515bc0d9048cbe416ff5d4e04883123
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25dfd01b65fabf7d9965319eb195e3bf62d08bf5135e420fc1e29685220366a676d5b6f66f02e2b884f5c5d34b368dba07308c3d09138d6f3f67469768e6ad4
|
7
|
+
data.tar.gz: d20dde81ffbc3ad01fe891e5671d262a3f3fae50a1b0872e0e7e0825991e6b5951794b0f668622843d3b299d70460fefafbc45b8ee934a38fa035d5d750769e8
|
data/CHANGELOG.md
CHANGED
@@ -370,6 +370,9 @@ module Netzke::Basepack::DataAdapters
|
|
370
370
|
value = v["value"]
|
371
371
|
op = v['comparison']
|
372
372
|
|
373
|
+
# safety
|
374
|
+
raise "Invalid filter operator '#{op}'" unless op.blank? || %w(lt gt lteq gteq eq contains).include?(op)
|
375
|
+
|
373
376
|
col_filter = @cls.inject(nil) { |fil, col|
|
374
377
|
if col.is_a?(Hash) && col[:filter_with] && col[:name].to_sym == v['field'].to_sym
|
375
378
|
fil = col[:filter_with]
|
@@ -382,7 +385,6 @@ module Netzke::Basepack::DataAdapters
|
|
382
385
|
next
|
383
386
|
end
|
384
387
|
|
385
|
-
|
386
388
|
case v["type"]
|
387
389
|
when "string"
|
388
390
|
res = res.where(arel_table[field].matches("%#{value}%"))
|
@@ -390,8 +392,8 @@ module Netzke::Basepack::DataAdapters
|
|
390
392
|
# convert value to the DB date
|
391
393
|
value.match(/(\d\d)\/(\d\d)\/(\d\d\d\d)/)
|
392
394
|
if op == 'eq'
|
393
|
-
res = res.where(arel_table[field].
|
394
|
-
res = res.where(arel_table[field].
|
395
|
+
res = res.where(arel_table[field].gteq("#{$3}-#{$1}-#{$2}".to_date.beginning_of_day))
|
396
|
+
res = res.where(arel_table[field].lteq("#{$3}-#{$1}-#{$2}".to_date.end_of_day))
|
395
397
|
else
|
396
398
|
res = res.where(arel_table[field].send(op, "#{$3}-#{$1}-#{$2}".to_time))
|
397
399
|
end
|
Binary file
|
Binary file
|
@@ -15,46 +15,50 @@ Background:
|
|
15
15
|
|
16
16
|
@javascript
|
17
17
|
Scenario: Numeric and text filter
|
18
|
+
# Note that it's important to build the scenario so that the filtering results are always changing, showing a different
|
19
|
+
# amount of records each time. Otherwise we may not catch a server exception, when the number of records wouldn't change
|
20
|
+
# either.
|
18
21
|
When I go to the BookGridFiltering test page
|
19
22
|
And I enable filter on column "exemplars" with value "{gt:6}"
|
20
23
|
Then the grid should show 1 records
|
21
24
|
|
22
|
-
When I clear all filters in the grid
|
23
|
-
And I enable filter on column "exemplars" with value "{eq:5}"
|
24
|
-
Then the grid should show 1 records
|
25
|
-
|
26
25
|
When I clear all filters in the grid
|
27
26
|
And I enable filter on column "exemplars" with value "{eq:6}"
|
28
27
|
Then the grid should show 0 records
|
29
28
|
|
29
|
+
When I clear all filters in the grid
|
30
|
+
And I enable filter on column "exemplars" with value "{eq:5}"
|
31
|
+
Then the grid should show 1 records
|
32
|
+
|
30
33
|
# NOTE: due to some mystery, this wouldn't work in a separate scenario (e.g. "Text filter")
|
31
34
|
# That is, the filter just wouldn't get set.
|
32
35
|
When I clear all filters in the grid
|
33
36
|
And I enable filter on column "notes" with value "'read'"
|
34
37
|
Then the grid should show 2 records
|
35
38
|
|
36
|
-
When I clear all filters in the grid
|
37
|
-
And I enable filter on column "author__first_name" with value "'d'"
|
38
|
-
Then the grid should show 2 records
|
39
|
-
|
40
39
|
When I clear all filters in the grid
|
41
40
|
And I enable filter on column "author__first_name" with value "'carl'"
|
42
41
|
Then the grid should show 1 records
|
43
42
|
|
44
43
|
When I clear all filters in the grid
|
44
|
+
And I enable filter on column "author__first_name" with value "'d'"
|
45
|
+
Then the grid should show 2 records
|
46
|
+
|
47
|
+
When I clear all filters in the grid
|
48
|
+
And I wait for response from server
|
45
49
|
And I enable date filter on column "last_read_at" with value "on 04/25/2011"
|
46
50
|
Then the grid should show 1 records
|
47
51
|
|
48
52
|
When I clear all filters in the grid
|
49
|
-
And I enable date filter on column "last_read_at" with value "after
|
50
|
-
Then the grid should show
|
53
|
+
And I enable date filter on column "last_read_at" with value "after 12/23/2010"
|
54
|
+
Then the grid should show 2 records
|
51
55
|
|
52
56
|
When I clear all filters in the grid
|
53
|
-
And I enable date filter on column "last_read_at" with value "
|
57
|
+
And I enable date filter on column "last_read_at" with value "after 04/25/2011"
|
54
58
|
Then the grid should show 1 records
|
55
59
|
|
56
60
|
When I clear all filters in the grid
|
57
|
-
And I enable date filter on column "last_read_at" with value "
|
61
|
+
And I enable date filter on column "last_read_at" with value "before 04/26/2011"
|
58
62
|
Then the grid should show 2 records
|
59
63
|
|
60
64
|
When I clear all filters in the grid
|