data_table 0.4.14 → 0.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile.lock +105 -70
- data/lib/data_table/base.rb +6 -1
- data/lib/data_table/version.rb +1 -1
- data/spec/data_table_spec.rb +4 -3
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmNhZmNhMGE5ZGMwMzY3OTY3OGQ5ODE4YTdiYTc3MWQyZmZjMDlmMw==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5f6eb1a2eb9c1473333cab8ec7fae903f44d643bbe7ec1b4cb2fd3af11d3b771
|
4
|
+
data.tar.gz: 345ff62642d154edde8a2913745f62be3f58b5da649aeeaa8e6cb1dcbcaa3a35
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YjMxYmM1ODRmNjgzYTBjNzQxM2RkMjY0NTg5OWIzN2NiZTk3ZGM0MjgyYmYw
|
11
|
-
ZTEzYWI3Y2E5ZWRjOWVhMGIzNjJhZjdkN2E4N2RjZTZiOTg4ZmE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NGE3NjFhZDhmYjIxZjVkYTJlYWY3MmEzMzYxZGY0ZGZlOWIwZmVlNDdjZmYy
|
14
|
-
ZWMwY2RhYjAwZjRiOTI0NzBkMDAyMWYxMmUwMDczY2FlODM1YTZhYWZkOTgz
|
15
|
-
NjE2YjQ0MDI1NjY0ODM2MzRhMDljY2IzNzk4ZGZjOWMyODM5ZjA=
|
6
|
+
metadata.gz: 0b6f00d0785e2d795dc32000f6b8c00f16711d3a74221f7d26b4db193e766137b8bead3954e1506c86e59d6d91576ee451a1ec2cd276fd88d33bdf0f405aaa60
|
7
|
+
data.tar.gz: 269b1b2cbfabe73a2b42b85d904eaa785b0a709d61b6556fcb7f24e7b1c9478142801fdac293a228431fc8a76dc1012b09fd35da992c25b3ac45bcfa1d7f9c9c
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,106 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
data_table (0.4.
|
4
|
+
data_table (0.4.15)
|
5
5
|
rails (>= 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
actionpack (=
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
actioncable (5.2.0)
|
11
|
+
actionpack (= 5.2.0)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailer (5.2.0)
|
15
|
+
actionpack (= 5.2.0)
|
16
|
+
actionview (= 5.2.0)
|
17
|
+
activejob (= 5.2.0)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.2.0)
|
21
|
+
actionview (= 5.2.0)
|
22
|
+
activesupport (= 5.2.0)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (>= 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.2.0)
|
28
|
+
activesupport (= 5.2.0)
|
21
29
|
builder (~> 3.1)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
erubi (~> 1.4)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.2.0)
|
34
|
+
activesupport (= 5.2.0)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.2.0)
|
37
|
+
activesupport (= 5.2.0)
|
38
|
+
activerecord (5.2.0)
|
39
|
+
activemodel (= 5.2.0)
|
40
|
+
activesupport (= 5.2.0)
|
41
|
+
arel (>= 9.0)
|
42
|
+
activestorage (5.2.0)
|
43
|
+
actionpack (= 5.2.0)
|
44
|
+
activerecord (= 5.2.0)
|
45
|
+
marcel (~> 0.3.1)
|
46
|
+
activesupport (5.2.0)
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
|
+
i18n (>= 0.7, < 2)
|
33
49
|
minitest (~> 5.1)
|
34
|
-
thread_safe (~> 0.1)
|
35
50
|
tzinfo (~> 1.1)
|
36
|
-
arel (
|
37
|
-
builder (3.2.
|
51
|
+
arel (9.0.0)
|
52
|
+
builder (3.2.3)
|
53
|
+
concurrent-ruby (1.0.5)
|
54
|
+
crass (1.0.4)
|
38
55
|
diff-lcs (1.2.4)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
erubi (1.7.1)
|
57
|
+
globalid (0.4.1)
|
58
|
+
activesupport (>= 4.2.0)
|
59
|
+
i18n (1.0.1)
|
60
|
+
concurrent-ruby (~> 1.0)
|
61
|
+
loofah (2.2.2)
|
62
|
+
crass (~> 1.0.2)
|
63
|
+
nokogiri (>= 1.5.9)
|
64
|
+
mail (2.7.0)
|
65
|
+
mini_mime (>= 0.1.1)
|
66
|
+
marcel (0.3.2)
|
67
|
+
mimemagic (~> 0.3.2)
|
68
|
+
method_source (0.9.0)
|
69
|
+
mimemagic (0.3.2)
|
70
|
+
mini_mime (1.0.0)
|
71
|
+
mini_portile2 (2.3.0)
|
72
|
+
minitest (5.11.3)
|
73
|
+
nio4r (2.3.1)
|
74
|
+
nokogiri (1.8.4)
|
75
|
+
mini_portile2 (~> 2.3.0)
|
76
|
+
rack (2.0.5)
|
77
|
+
rack-test (1.0.0)
|
78
|
+
rack (>= 1.0, < 3)
|
79
|
+
rails (5.2.0)
|
80
|
+
actioncable (= 5.2.0)
|
81
|
+
actionmailer (= 5.2.0)
|
82
|
+
actionpack (= 5.2.0)
|
83
|
+
actionview (= 5.2.0)
|
84
|
+
activejob (= 5.2.0)
|
85
|
+
activemodel (= 5.2.0)
|
86
|
+
activerecord (= 5.2.0)
|
87
|
+
activestorage (= 5.2.0)
|
88
|
+
activesupport (= 5.2.0)
|
89
|
+
bundler (>= 1.3.0)
|
90
|
+
railties (= 5.2.0)
|
91
|
+
sprockets-rails (>= 2.0.0)
|
92
|
+
rails-dom-testing (2.0.3)
|
93
|
+
activesupport (>= 4.2.0)
|
94
|
+
nokogiri (>= 1.6)
|
95
|
+
rails-html-sanitizer (1.0.4)
|
96
|
+
loofah (~> 2.2, >= 2.2.2)
|
97
|
+
railties (5.2.0)
|
98
|
+
actionpack (= 5.2.0)
|
99
|
+
activesupport (= 5.2.0)
|
100
|
+
method_source
|
66
101
|
rake (>= 0.8.7)
|
67
102
|
thor (>= 0.18.1, < 2.0)
|
68
|
-
rake (
|
103
|
+
rake (12.3.1)
|
69
104
|
rr (1.1.2)
|
70
105
|
rspec (2.14.1)
|
71
106
|
rspec-core (~> 2.14.0)
|
@@ -76,23 +111,20 @@ GEM
|
|
76
111
|
diff-lcs (>= 1.1.3, < 2.0)
|
77
112
|
rspec-mocks (2.14.3)
|
78
113
|
shoulda (2.11.3)
|
79
|
-
sprockets (
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
thread_safe (0.3.3)
|
90
|
-
tilt (1.4.1)
|
91
|
-
treetop (1.4.15)
|
92
|
-
polyglot
|
93
|
-
polyglot (>= 0.3.1)
|
94
|
-
tzinfo (1.1.0)
|
114
|
+
sprockets (3.7.2)
|
115
|
+
concurrent-ruby (~> 1.0)
|
116
|
+
rack (> 1, < 3)
|
117
|
+
sprockets-rails (3.2.1)
|
118
|
+
actionpack (>= 4.0)
|
119
|
+
activesupport (>= 4.0)
|
120
|
+
sprockets (>= 3.0.0)
|
121
|
+
thor (0.20.0)
|
122
|
+
thread_safe (0.3.6)
|
123
|
+
tzinfo (1.2.5)
|
95
124
|
thread_safe (~> 0.1)
|
125
|
+
websocket-driver (0.7.0)
|
126
|
+
websocket-extensions (>= 0.1.0)
|
127
|
+
websocket-extensions (0.1.3)
|
96
128
|
|
97
129
|
PLATFORMS
|
98
130
|
ruby
|
@@ -102,3 +134,6 @@ DEPENDENCIES
|
|
102
134
|
rr (~> 1.0)
|
103
135
|
rspec (~> 2.0)
|
104
136
|
shoulda (~> 2.11)
|
137
|
+
|
138
|
+
BUNDLED WITH
|
139
|
+
1.16.1
|
data/lib/data_table/base.rb
CHANGED
@@ -7,7 +7,12 @@ module DataTable
|
|
7
7
|
|
8
8
|
module ClassMethods
|
9
9
|
def for_data_table controller, fields, search_fields=nil, explicit_block=nil, &implicit_block
|
10
|
-
|
10
|
+
incoming_params = if controller.params.respond_to?(:permit) then
|
11
|
+
controller.params.permit(:sSearch, :sEcho, :iDisplayStart, :iDisplayLength, :iSortCol_0, :sSortDir_0)
|
12
|
+
else
|
13
|
+
controller.params
|
14
|
+
end
|
15
|
+
params = Hash[*incoming_params.to_h.map {|key, value| [key.to_s.downcase.to_sym, value] }.flatten]
|
11
16
|
search_fields ||= fields
|
12
17
|
block = (explicit_block or implicit_block)
|
13
18
|
|
data/lib/data_table/version.rb
CHANGED
data/spec/data_table_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "action_controller/metal/strong_parameters"
|
2
3
|
|
3
4
|
describe DataTable do
|
4
5
|
|
@@ -16,9 +17,9 @@ describe DataTable do
|
|
16
17
|
context "#for_data_table" do
|
17
18
|
|
18
19
|
it "should produce JSON for the datatables plugin to consume" do
|
19
|
-
params =
|
20
|
+
params = ActionController::Parameters.new(sSearch: "answer", iSortCol_0: "0", sSortDir_0: "desc", iDisplayLength: "10", sEcho: "1")
|
20
21
|
normalized_params = {ssearch: "answer", isortcol_0: "0", ssortdir_0: "desc", idisplaylength: "10", secho: "1"}
|
21
|
-
controller =
|
22
|
+
controller = stub!.params { params }.subject
|
22
23
|
|
23
24
|
fields = %w(foo bar baz)
|
24
25
|
search_fields = %w(foo bar)
|
@@ -35,7 +36,7 @@ describe DataTable do
|
|
35
36
|
|
36
37
|
it "should work with a pagination library that doesn't respond to #total_entries" do
|
37
38
|
params = {:ssearch => "answer", :isortcol_0 => "0", :ssortdir_0 => "desc", :idisplaylength => "10", :secho => "1"}
|
38
|
-
controller =
|
39
|
+
controller = stub!.params { params }.subject
|
39
40
|
|
40
41
|
fields = %w(foo bar baz)
|
41
42
|
search_fields = %w(foo bar)
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Dew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: shoulda
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.11'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.11'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
69
|
description: Simple data preparation from AR/Mongoid to the jQuery DataTables plugin
|
@@ -73,9 +73,9 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .rspec
|
78
|
-
- .rvmrc
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".rvmrc"
|
79
79
|
- Gemfile
|
80
80
|
- Gemfile.lock
|
81
81
|
- LICENSE
|
@@ -104,17 +104,17 @@ require_paths:
|
|
104
104
|
- lib
|
105
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- -
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project: data_table
|
117
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.7.6
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Simple data preparation from AR/Mongoid to the jQuery DataTables plugin
|