trk_datatables 0.2.15 → 0.2.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d7a8767e7c4b77bbdd9d47b478de7b6b3dd456c449e83e50a70c4b674121fa7
4
- data.tar.gz: aedc1d098b6ddd648a7b18fbf99cc88dede84f63a63c7ececa704fcb8bb0d018
3
+ metadata.gz: bd9a91c8dcfc2bf1e0a7c77071e55a9d288643616f645bb15d8e47eedf1f75fe
4
+ data.tar.gz: 4d3be581d0f6682b31b9a78d31f60559f00739f65041bf742f9812b6b7505ca0
5
5
  SHA512:
6
- metadata.gz: 890f228e839a1e25ab96db11cf92c2b9a328be57f49e202ad77d2071b2c4ccdec65c31bcb57f5743c3fabbca00cb0f941c9df15364025413a73616e23b906095
7
- data.tar.gz: 9a6744711a901ea792c54633f4eac570a36c9547f8e86f9d112f4ed175d5f7838f33ccb2b33b529cde15f82bd7184edaec881056afb88f183b1df203b8139fa9
6
+ metadata.gz: ab0b8c20502fca77a59c4bfb8ee7fcb9cbe7a734eb981d034591deae16847103fe0f947ff4bafb7e967c9e32b2e15357bcc5b888921df220c2ec2f205b438f95
7
+ data.tar.gz: d3e5325a5f6eadad16af3f69af3cea1e910d31706e27704760694ca55a3dc8873af25833f6e346c7b3a9b892ea9b9e57cd375edd6d5add94d1b7bd409da56086
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.7
data/Appraisals ADDED
@@ -0,0 +1,23 @@
1
+ appraise "rails-5" do
2
+ gem "rails", "~> 5.2.0"
3
+ gem "i18n", "~> 1.8", "< 1.9"
4
+ gem "nokogiri", "~> 1.15.0"
5
+ gem "pg", "~> 1.5.0"
6
+ gem "sqlite3", "~> 1.6.0"
7
+ gem "standard", "~> 1.35.0"
8
+ end
9
+
10
+ appraise "rails-6" do
11
+ gem "rails", "~> 6.0.0"
12
+ gem "sqlite3", "~> 1.6.0"
13
+ end
14
+
15
+ appraise "rails-7" do
16
+ gem "rails", "~> 7.0.0"
17
+ gem "sqlite3", "~> 1.6.0"
18
+ end
19
+
20
+ appraise "rails-7-1" do
21
+ gem "rails", "~> 7.1.0"
22
+ gem "sqlite3", ">= 2.0.0"
23
+ end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in trk_datatables.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,61 +1,126 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trk_datatables (0.2.15)
4
+ trk_datatables (0.2.18)
5
5
  activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.1.7.2)
11
- activesupport (= 6.1.7.2)
12
- activerecord (6.1.7.2)
13
- activemodel (= 6.1.7.2)
14
- activesupport (= 6.1.7.2)
15
- activesupport (6.1.7.2)
10
+ activemodel (7.1.6)
11
+ activesupport (= 7.1.6)
12
+ activerecord (7.1.6)
13
+ activemodel (= 7.1.6)
14
+ activesupport (= 7.1.6)
15
+ timeout (>= 0.4.0)
16
+ activesupport (7.1.6)
17
+ base64
18
+ benchmark (>= 0.3)
19
+ bigdecimal
16
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
+ connection_pool (>= 2.2.5)
22
+ drb
17
23
  i18n (>= 1.6, < 2)
24
+ logger (>= 1.4.2)
18
25
  minitest (>= 5.1)
26
+ mutex_m
27
+ securerandom (>= 0.3)
19
28
  tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
29
+ appraisal (2.5.0)
30
+ bundler
31
+ rake
32
+ thor (>= 0.14.0)
33
+ ast (2.4.2)
34
+ base64 (0.3.0)
35
+ benchmark (0.5.0)
36
+ bigdecimal (4.1.2)
21
37
  byebug (11.1.3)
22
- concurrent-ruby (1.2.0)
38
+ concurrent-ruby (1.3.7)
39
+ connection_pool (2.5.5)
23
40
  database_cleaner (2.0.1)
24
41
  database_cleaner-active_record (~> 2.0.0)
25
42
  database_cleaner-active_record (2.0.1)
26
43
  activerecord (>= 5.a)
27
44
  database_cleaner-core (~> 2.0.0)
28
45
  database_cleaner-core (2.0.1)
29
- i18n (1.12.0)
46
+ drb (2.2.3)
47
+ i18n (1.14.8)
30
48
  concurrent-ruby (~> 1.0)
31
- mini_portile2 (2.8.1)
32
- minitest (5.17.0)
49
+ json (2.7.2)
50
+ language_server-protocol (3.17.0.3)
51
+ lint_roller (1.1.0)
52
+ logger (1.7.0)
53
+ mini_portile2 (2.8.9)
54
+ minitest (5.26.1)
33
55
  minitest-color (0.0.2)
34
56
  minitest (~> 5)
57
+ mutex_m (0.3.0)
58
+ parallel (1.24.0)
59
+ parser (3.3.0.5)
60
+ ast (~> 2.4.1)
61
+ racc
35
62
  pg (1.4.5)
36
- rake (10.5.0)
37
- sqlite3 (1.6.0)
63
+ racc (1.7.3)
64
+ rainbow (3.1.1)
65
+ rake (13.4.2)
66
+ regexp_parser (2.9.0)
67
+ rexml (3.2.6)
68
+ rubocop (1.62.1)
69
+ json (~> 2.3)
70
+ language_server-protocol (>= 3.17.0)
71
+ parallel (~> 1.10)
72
+ parser (>= 3.3.0.2)
73
+ rainbow (>= 2.2.2, < 4.0)
74
+ regexp_parser (>= 1.8, < 3.0)
75
+ rexml (>= 3.2.5, < 4.0)
76
+ rubocop-ast (>= 1.31.1, < 2.0)
77
+ ruby-progressbar (~> 1.7)
78
+ unicode-display_width (>= 2.4.0, < 3.0)
79
+ rubocop-ast (1.31.2)
80
+ parser (>= 3.3.0.4)
81
+ rubocop-performance (1.20.2)
82
+ rubocop (>= 1.48.1, < 2.0)
83
+ rubocop-ast (>= 1.30.0, < 2.0)
84
+ ruby-progressbar (1.13.0)
85
+ securerandom (0.3.2)
86
+ sqlite3 (2.9.5)
38
87
  mini_portile2 (~> 2.8.0)
88
+ standard (1.35.1)
89
+ language_server-protocol (~> 3.17.0.2)
90
+ lint_roller (~> 1.0)
91
+ rubocop (~> 1.62.0)
92
+ standard-custom (~> 1.0.0)
93
+ standard-performance (~> 1.3)
94
+ standard-custom (1.0.2)
95
+ lint_roller (~> 1.0)
96
+ rubocop (~> 1.50)
97
+ standard-performance (1.3.1)
98
+ lint_roller (~> 1.1)
99
+ rubocop-performance (~> 1.20.2)
100
+ thor (1.3.1)
39
101
  timecop (0.9.6)
102
+ timeout (0.6.1)
40
103
  tzinfo (2.0.6)
41
104
  concurrent-ruby (~> 1.0)
42
- zeitwerk (2.6.6)
105
+ unicode-display_width (2.5.0)
43
106
 
44
107
  PLATFORMS
45
108
  ruby
46
109
 
47
110
  DEPENDENCIES
48
- activerecord (~> 6.0)
111
+ activerecord (>= 5.0)
112
+ appraisal
49
113
  bundler (~> 2.0)
50
114
  byebug
51
115
  database_cleaner
52
116
  minitest (~> 5.0)
53
117
  minitest-color
54
118
  pg
55
- rake (~> 10.0)
56
- sqlite3
119
+ rake (>= 10.0)
120
+ sqlite3 (>= 1.4)
121
+ standard
57
122
  timecop
58
123
  trk_datatables!
59
124
 
60
125
  BUNDLED WITH
61
- 2.2.15
126
+ 2.7.2
data/README.md CHANGED
@@ -220,7 +220,8 @@ class PostsDatatable < TrkDatatables::ActiveRecord
220
220
  # instead Post.all you should use Post.joins(:user) or
221
221
  # Post.left_joins(:user) if user is optional. For has_many relations you
222
222
  # need to join them since you will get multiple table rows
223
- %w[posts.body users.name]
223
+ # Post.left_joins(:comments).group("id")
224
+ %w[posts.body users.name comments.body]
224
225
  end
225
226
  end
226
227
  ```
@@ -372,11 +373,11 @@ use empty column_key
372
373
  ```
373
374
 
374
375
  If you have more columns that are not actually columns in database (for example
375
- links or Ruby calculated values) than you can not use empty column_key since
376
- there could be only one (keys in the hash should be unique). When you disable
377
- `order` and `search` than you can use any column name since that column will not
378
- be used in queries. For example column key `posts.body_size` is not in database
379
- nor in Ruby code.
376
+ links or Ruby calculated in ruby values) than you can not use empty column_key
377
+ since there could be only one (keys in the hash should be unique). When you
378
+ disable `order` and `search` than you can use any column name since that column
379
+ will not be used in queries. For example column key `posts.body_size` is not in
380
+ database nor in Ruby code.
380
381
 
381
382
  ```
382
383
  def columns
@@ -727,12 +728,18 @@ save preferences) and this default values will be used
727
728
  # app/datatables/posts_datatable.rb
728
729
  class PostsDatatable
729
730
  # when we show invoice_no on first column, and that is reset every year
730
- # on first april, than it is better is to use date column ordering
731
+ # on first april, than it is better is to use last (date) column ordering
731
732
  # column starts from zero 0, 1, 2, 3
732
733
  def default_order
733
734
  [[columns.size - 1, :desc]]
734
735
  end
735
736
 
737
+ # order by
738
+ def default_order
739
+ index_by_column_key "users.updated_at"
740
+ end
741
+
742
+
736
743
  def default_page_length
737
744
  20
738
745
  end
@@ -1118,6 +1125,29 @@ ruby -I test test/trk_datatables/base_test.rb
1118
1125
  ruby -I test test/trk_datatables/base_test.rb -n /additional/
1119
1126
  ```
1120
1127
 
1128
+ Run the Appraisal matrix when changing ActiveRecord, Rails, or adapter support:
1129
+
1130
+ ```
1131
+ # install appraisal gemfiles
1132
+ ASDF_RUBY_VERSION=3.4.7 bundle exec appraisal install
1133
+
1134
+ # run the Ruby 3.4 Rails matrix
1135
+ ASDF_RUBY_VERSION=3.4.7 bundle exec appraisal rails-6 rake
1136
+ ASDF_RUBY_VERSION=3.4.7 bundle exec appraisal rails-7 rake
1137
+ ASDF_RUBY_VERSION=3.4.7 bundle exec appraisal rails-7-1 rake
1138
+ ```
1139
+
1140
+ Rails 5.2 is supported as a legacy appraisal on Ruby 2.7:
1141
+
1142
+ ```
1143
+ ASDF_RUBY_VERSION=2.7.8 BUNDLE_GEMFILE=gemfiles/rails_5.gemfile bundle exec rake
1144
+ ```
1145
+
1146
+ Install
1147
+ ```
1148
+ ASDF_RUBY_VERSION=3.4.7 BUNDLER_VERSION=2.7.2 BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle _2.7.2_ install
1149
+ ```
1150
+
1121
1151
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
1122
1152
 
1123
1153
  To install this gem onto your local machine, run `bundle exec rake install`. To
@@ -1161,6 +1191,12 @@ Column filtering with dropdowns https://datatables.net/extensions/searchpanes/ex
1161
1191
  Adding graphs https://datatables.net/forums/discussion/comment/123621/#Comment_123621
1162
1192
  https://datatables.net/examples/api/highcharts.html
1163
1193
 
1194
+ Run custom JS on next page or search, for example load tooltip.
1195
+
1196
+
1197
+ Check issue when we use param_set for select_options field since select option
1198
+ does not get selected and next page will show all items instead of only ones
1199
+ with selected field.
1164
1200
 
1165
1201
  ## License
1166
1202
 
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ require "bundler/setup"
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
3
4
 
4
5
  Rake::TestTask.new(:test) do |t|
5
- t.libs << 'test'
6
- t.libs << 'lib'
7
- t.test_files = FileList['test/**/*_test.rb']
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/*_test.rb"]
8
9
  end
9
10
 
10
11
  task default: :test
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.2.0"
6
+ gem "i18n", "~> 1.8", "< 1.9"
7
+ gem "nokogiri", "~> 1.15.0"
8
+ gem "pg", "~> 1.5.0"
9
+ gem "sqlite3", "~> 1.6.0"
10
+ gem "standard", "~> 1.35.0"
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,224 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ trk_datatables (0.2.17)
5
+ activesupport
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.2.8.1)
11
+ actionpack (= 5.2.8.1)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.8.1)
15
+ actionpack (= 5.2.8.1)
16
+ actionview (= 5.2.8.1)
17
+ activejob (= 5.2.8.1)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.8.1)
21
+ actionview (= 5.2.8.1)
22
+ activesupport (= 5.2.8.1)
23
+ rack (~> 2.0, >= 2.0.8)
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.8.1)
28
+ activesupport (= 5.2.8.1)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.8.1)
34
+ activesupport (= 5.2.8.1)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.8.1)
37
+ activesupport (= 5.2.8.1)
38
+ activerecord (5.2.8.1)
39
+ activemodel (= 5.2.8.1)
40
+ activesupport (= 5.2.8.1)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.8.1)
43
+ actionpack (= 5.2.8.1)
44
+ activerecord (= 5.2.8.1)
45
+ marcel (~> 1.0.0)
46
+ activesupport (5.2.8.1)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
51
+ appraisal (2.5.0)
52
+ bundler
53
+ rake
54
+ thor (>= 0.14.0)
55
+ arel (9.0.0)
56
+ ast (2.4.3)
57
+ base64 (0.3.0)
58
+ builder (3.3.0)
59
+ byebug (11.1.3)
60
+ concurrent-ruby (1.3.7)
61
+ crass (1.0.7)
62
+ database_cleaner (2.1.0)
63
+ database_cleaner-active_record (>= 2, < 3)
64
+ database_cleaner-active_record (2.2.2)
65
+ activerecord (>= 5.a)
66
+ database_cleaner-core (~> 2.0)
67
+ database_cleaner-core (2.1.0)
68
+ date (3.5.1)
69
+ erubi (1.13.1)
70
+ globalid (1.1.0)
71
+ activesupport (>= 5.0)
72
+ i18n (1.8.11)
73
+ concurrent-ruby (~> 1.0)
74
+ json (2.20.0)
75
+ language_server-protocol (3.17.0.5)
76
+ lint_roller (1.1.0)
77
+ logger (1.7.0)
78
+ loofah (2.25.1)
79
+ crass (~> 1.0.2)
80
+ nokogiri (>= 1.12.0)
81
+ mail (2.9.0)
82
+ logger
83
+ mini_mime (>= 0.1.1)
84
+ net-imap
85
+ net-pop
86
+ net-smtp
87
+ marcel (1.0.4)
88
+ method_source (1.1.0)
89
+ mini_mime (1.1.5)
90
+ mini_portile2 (2.8.9)
91
+ minitest (5.26.1)
92
+ minitest-color (0.0.2)
93
+ minitest (~> 5)
94
+ net-imap (0.4.24)
95
+ date
96
+ net-protocol
97
+ net-pop (0.1.2)
98
+ net-protocol
99
+ net-protocol (0.2.2)
100
+ timeout
101
+ net-smtp (0.5.1)
102
+ net-protocol
103
+ nio4r (2.7.5)
104
+ nokogiri (1.15.7)
105
+ mini_portile2 (~> 2.8.2)
106
+ racc (~> 1.4)
107
+ nokogiri (1.15.7-arm64-darwin)
108
+ racc (~> 1.4)
109
+ parallel (1.28.0)
110
+ parser (3.3.11.1)
111
+ ast (~> 2.4.1)
112
+ racc
113
+ pg (1.5.9)
114
+ prism (1.9.0)
115
+ racc (1.8.1)
116
+ rack (2.2.9)
117
+ rack-test (2.2.0)
118
+ rack (>= 1.3)
119
+ rails (5.2.8.1)
120
+ actioncable (= 5.2.8.1)
121
+ actionmailer (= 5.2.8.1)
122
+ actionpack (= 5.2.8.1)
123
+ actionview (= 5.2.8.1)
124
+ activejob (= 5.2.8.1)
125
+ activemodel (= 5.2.8.1)
126
+ activerecord (= 5.2.8.1)
127
+ activestorage (= 5.2.8.1)
128
+ activesupport (= 5.2.8.1)
129
+ bundler (>= 1.3.0)
130
+ railties (= 5.2.8.1)
131
+ sprockets-rails (>= 2.0.0)
132
+ rails-dom-testing (2.3.0)
133
+ activesupport (>= 5.0.0)
134
+ minitest
135
+ nokogiri (>= 1.6)
136
+ rails-html-sanitizer (1.7.0)
137
+ loofah (~> 2.25)
138
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
139
+ railties (5.2.8.1)
140
+ actionpack (= 5.2.8.1)
141
+ activesupport (= 5.2.8.1)
142
+ method_source
143
+ rake (>= 0.8.7)
144
+ thor (>= 0.19.0, < 2.0)
145
+ rainbow (3.1.1)
146
+ rake (13.4.2)
147
+ regexp_parser (2.12.0)
148
+ rexml (3.4.4)
149
+ rubocop (1.62.1)
150
+ json (~> 2.3)
151
+ language_server-protocol (>= 3.17.0)
152
+ parallel (~> 1.10)
153
+ parser (>= 3.3.0.2)
154
+ rainbow (>= 2.2.2, < 4.0)
155
+ regexp_parser (>= 1.8, < 3.0)
156
+ rexml (>= 3.2.5, < 4.0)
157
+ rubocop-ast (>= 1.31.1, < 2.0)
158
+ ruby-progressbar (~> 1.7)
159
+ unicode-display_width (>= 2.4.0, < 3.0)
160
+ rubocop-ast (1.49.1)
161
+ parser (>= 3.3.7.2)
162
+ prism (~> 1.7)
163
+ rubocop-performance (1.21.1)
164
+ rubocop (>= 1.48.1, < 2.0)
165
+ rubocop-ast (>= 1.31.1, < 2.0)
166
+ ruby-progressbar (1.13.0)
167
+ sprockets (4.2.1)
168
+ concurrent-ruby (~> 1.0)
169
+ rack (>= 2.2.4, < 4)
170
+ sprockets-rails (3.4.2)
171
+ actionpack (>= 5.2)
172
+ activesupport (>= 5.2)
173
+ sprockets (>= 3.0.0)
174
+ sqlite3 (1.6.9)
175
+ mini_portile2 (~> 2.8.0)
176
+ sqlite3 (1.6.9-arm64-darwin)
177
+ standard (1.35.1)
178
+ language_server-protocol (~> 3.17.0.2)
179
+ lint_roller (~> 1.0)
180
+ rubocop (~> 1.62.0)
181
+ standard-custom (~> 1.0.0)
182
+ standard-performance (~> 1.3)
183
+ standard-custom (1.0.2)
184
+ lint_roller (~> 1.0)
185
+ rubocop (~> 1.50)
186
+ standard-performance (1.4.0)
187
+ lint_roller (~> 1.1)
188
+ rubocop-performance (~> 1.21.0)
189
+ thor (1.5.0)
190
+ thread_safe (0.3.6)
191
+ timecop (0.9.11)
192
+ timeout (0.6.1)
193
+ tzinfo (1.2.11)
194
+ thread_safe (~> 0.1)
195
+ unicode-display_width (2.6.0)
196
+ websocket-driver (0.8.2)
197
+ base64
198
+ websocket-extensions (>= 0.1.0)
199
+ websocket-extensions (0.1.5)
200
+
201
+ PLATFORMS
202
+ arm64-darwin-24
203
+ ruby
204
+
205
+ DEPENDENCIES
206
+ activerecord (>= 5.0)
207
+ appraisal
208
+ bundler (~> 2.0)
209
+ byebug
210
+ database_cleaner
211
+ i18n (~> 1.8, < 1.9)
212
+ minitest (~> 5.0)
213
+ minitest-color
214
+ nokogiri (~> 1.15.0)
215
+ pg (~> 1.5.0)
216
+ rails (~> 5.2.0)
217
+ rake (>= 10.0)
218
+ sqlite3 (~> 1.6.0)
219
+ standard (~> 1.35.0)
220
+ timecop
221
+ trk_datatables!
222
+
223
+ BUNDLED WITH
224
+ 2.2.33
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 6.0.0"
6
+ gem "sqlite3", "~> 1.6.0"
7
+
8
+ gemspec path: "../"