administrate_exportable 0.6.3 → 0.7.0
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/.github/workflows/ci.yml +44 -0
- data/.tool-versions +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +273 -137
- data/README.md +34 -3
- data/Rakefile +3 -1
- data/administrate_exportable.gemspec +16 -16
- data/app/views/admin/application/_index_header.html.erb +1 -1
- data/lib/administrate_exportable/exporter.rb +2 -2
- data/lib/administrate_exportable/exporter_service.rb +9 -12
- data/lib/administrate_exportable/version.rb +1 -1
- data/lib/administrate_exportable.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66d0a1d7b10a17a14ff7c4553f751d34c756b1f1138614c15f1144b807e9161f
|
|
4
|
+
data.tar.gz: e7669105bcb5d34ddfb92520a57f07eb9c28871510cc7aa28a7bbd21189818b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afd7af1c25b548fac0bea63635190d6ac3a98cc30622390db4f02535ea33b7b3494a4bf71d672845466ba6caa5bbbe92e21e2bc2e79a98d96a5ec83bfe745840
|
|
7
|
+
data.tar.gz: 82b748cbd381e7890a2ce35a6f05029a4cab127c676f2c344237398734a59b499472ef863c417d3a7d835840ed3592f2a1ae1200dcfc604a9117727690a4ba2a
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- "*"
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
jobs:
|
|
11
|
+
tests:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
ruby: ["3.1", "3.2", "3.3", "3.4"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@master
|
|
19
|
+
|
|
20
|
+
- name: Set up Ruby
|
|
21
|
+
uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
|
24
|
+
bundler: default
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
|
|
27
|
+
- name: StandardRb check
|
|
28
|
+
run: bundle exec standardrb --format progress --format github --color
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: |
|
|
32
|
+
bundle exec rspec
|
|
33
|
+
docs:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@master
|
|
37
|
+
- name: Set up Ruby
|
|
38
|
+
uses: ruby/setup-ruby@v1
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: 3.3
|
|
41
|
+
bundler: default
|
|
42
|
+
bundler-cache: true
|
|
43
|
+
- name: Build docs
|
|
44
|
+
run: bundle exec rake yard
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby
|
|
1
|
+
ruby 3.1.6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,91 +1,137 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
administrate_exportable (0.
|
|
4
|
+
administrate_exportable (0.7.0)
|
|
5
5
|
actionview (>= 5.2.2.1)
|
|
6
6
|
administrate (>= 0.17.0)
|
|
7
|
+
csv (~> 3.0)
|
|
7
8
|
rails (>= 4.2)
|
|
8
9
|
railties (>= 5.2.2.1)
|
|
9
10
|
|
|
10
11
|
GEM
|
|
11
12
|
remote: https://rubygems.org/
|
|
12
13
|
specs:
|
|
13
|
-
actioncable (
|
|
14
|
-
actionpack (=
|
|
14
|
+
actioncable (7.1.6)
|
|
15
|
+
actionpack (= 7.1.6)
|
|
16
|
+
activesupport (= 7.1.6)
|
|
15
17
|
nio4r (~> 2.0)
|
|
16
18
|
websocket-driver (>= 0.6.1)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
activejob (=
|
|
19
|
+
zeitwerk (~> 2.6)
|
|
20
|
+
actionmailbox (7.1.6)
|
|
21
|
+
actionpack (= 7.1.6)
|
|
22
|
+
activejob (= 7.1.6)
|
|
23
|
+
activerecord (= 7.1.6)
|
|
24
|
+
activestorage (= 7.1.6)
|
|
25
|
+
activesupport (= 7.1.6)
|
|
26
|
+
mail (>= 2.7.1)
|
|
27
|
+
net-imap
|
|
28
|
+
net-pop
|
|
29
|
+
net-smtp
|
|
30
|
+
actionmailer (7.1.6)
|
|
31
|
+
actionpack (= 7.1.6)
|
|
32
|
+
actionview (= 7.1.6)
|
|
33
|
+
activejob (= 7.1.6)
|
|
34
|
+
activesupport (= 7.1.6)
|
|
21
35
|
mail (~> 2.5, >= 2.5.4)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
net-imap
|
|
37
|
+
net-pop
|
|
38
|
+
net-smtp
|
|
39
|
+
rails-dom-testing (~> 2.2)
|
|
40
|
+
actionpack (7.1.6)
|
|
41
|
+
actionview (= 7.1.6)
|
|
42
|
+
activesupport (= 7.1.6)
|
|
43
|
+
cgi
|
|
44
|
+
nokogiri (>= 1.8.5)
|
|
45
|
+
racc
|
|
46
|
+
rack (>= 2.2.4)
|
|
47
|
+
rack-session (>= 1.0.1)
|
|
27
48
|
rack-test (>= 0.6.3)
|
|
28
|
-
rails-dom-testing (~> 2.
|
|
29
|
-
rails-html-sanitizer (~> 1.
|
|
30
|
-
|
|
31
|
-
|
|
49
|
+
rails-dom-testing (~> 2.2)
|
|
50
|
+
rails-html-sanitizer (~> 1.6)
|
|
51
|
+
actiontext (7.1.6)
|
|
52
|
+
actionpack (= 7.1.6)
|
|
53
|
+
activerecord (= 7.1.6)
|
|
54
|
+
activestorage (= 7.1.6)
|
|
55
|
+
activesupport (= 7.1.6)
|
|
56
|
+
globalid (>= 0.6.0)
|
|
57
|
+
nokogiri (>= 1.8.5)
|
|
58
|
+
actionview (7.1.6)
|
|
59
|
+
activesupport (= 7.1.6)
|
|
32
60
|
builder (~> 3.1)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
rails-
|
|
36
|
-
|
|
37
|
-
|
|
61
|
+
cgi
|
|
62
|
+
erubi (~> 1.11)
|
|
63
|
+
rails-dom-testing (~> 2.2)
|
|
64
|
+
rails-html-sanitizer (~> 1.6)
|
|
65
|
+
activejob (7.1.6)
|
|
66
|
+
activesupport (= 7.1.6)
|
|
38
67
|
globalid (>= 0.3.6)
|
|
39
|
-
activemodel (
|
|
40
|
-
activesupport (=
|
|
41
|
-
activerecord (
|
|
42
|
-
activemodel (=
|
|
43
|
-
activesupport (=
|
|
44
|
-
|
|
45
|
-
activestorage (
|
|
46
|
-
actionpack (=
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
activemodel (7.1.6)
|
|
69
|
+
activesupport (= 7.1.6)
|
|
70
|
+
activerecord (7.1.6)
|
|
71
|
+
activemodel (= 7.1.6)
|
|
72
|
+
activesupport (= 7.1.6)
|
|
73
|
+
timeout (>= 0.4.0)
|
|
74
|
+
activestorage (7.1.6)
|
|
75
|
+
actionpack (= 7.1.6)
|
|
76
|
+
activejob (= 7.1.6)
|
|
77
|
+
activerecord (= 7.1.6)
|
|
78
|
+
activesupport (= 7.1.6)
|
|
79
|
+
marcel (~> 1.0)
|
|
80
|
+
activesupport (7.1.6)
|
|
81
|
+
base64
|
|
82
|
+
benchmark (>= 0.3)
|
|
83
|
+
bigdecimal
|
|
50
84
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
85
|
+
connection_pool (>= 2.2.5)
|
|
86
|
+
drb
|
|
87
|
+
i18n (>= 1.6, < 2)
|
|
88
|
+
logger (>= 1.4.2)
|
|
89
|
+
minitest (>= 5.1)
|
|
90
|
+
mutex_m
|
|
91
|
+
securerandom (>= 0.3)
|
|
92
|
+
tzinfo (~> 2.0)
|
|
93
|
+
administrate (0.19.0)
|
|
55
94
|
actionpack (>= 5.0)
|
|
56
95
|
actionview (>= 5.0)
|
|
57
96
|
activerecord (>= 5.0)
|
|
58
|
-
datetime_picker_rails (~> 0.0.7)
|
|
59
97
|
jquery-rails (>= 4.0)
|
|
60
98
|
kaminari (>= 1.0)
|
|
61
|
-
momentjs-rails (~> 2.8)
|
|
62
99
|
sassc-rails (~> 2.1)
|
|
63
100
|
selectize-rails (~> 0.6)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
ast (2.4.3)
|
|
102
|
+
base64 (0.3.0)
|
|
103
|
+
benchmark (0.5.0)
|
|
104
|
+
bigdecimal (4.0.1)
|
|
105
|
+
builder (3.3.0)
|
|
106
|
+
byebug (12.0.0)
|
|
107
|
+
cgi (0.5.1)
|
|
71
108
|
coderay (1.1.3)
|
|
72
|
-
concurrent-ruby (1.
|
|
109
|
+
concurrent-ruby (1.3.6)
|
|
110
|
+
connection_pool (2.5.5)
|
|
73
111
|
crass (1.0.6)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
diff-lcs (1.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
csv (3.3.5)
|
|
113
|
+
date (3.5.1)
|
|
114
|
+
diff-lcs (1.6.2)
|
|
115
|
+
drb (2.2.3)
|
|
116
|
+
erb (4.0.4)
|
|
117
|
+
cgi (>= 0.3.3)
|
|
118
|
+
erubi (1.13.1)
|
|
119
|
+
ffi (1.17.3)
|
|
120
|
+
ffi (1.17.3-arm64-darwin)
|
|
121
|
+
globalid (1.3.0)
|
|
122
|
+
activesupport (>= 6.1)
|
|
123
|
+
i18n (1.14.8)
|
|
84
124
|
concurrent-ruby (~> 1.0)
|
|
85
|
-
|
|
125
|
+
io-console (0.8.2)
|
|
126
|
+
irb (1.16.0)
|
|
127
|
+
pp (>= 0.6.0)
|
|
128
|
+
rdoc (>= 4.0.0)
|
|
129
|
+
reline (>= 0.4.2)
|
|
130
|
+
jquery-rails (4.6.1)
|
|
86
131
|
rails-dom-testing (>= 1, < 3)
|
|
87
132
|
railties (>= 4.2.0)
|
|
88
133
|
thor (>= 0.14, < 2.0)
|
|
134
|
+
json (2.18.1)
|
|
89
135
|
kaminari (1.2.2)
|
|
90
136
|
activesupport (>= 4.1.0)
|
|
91
137
|
kaminari-actionview (= 1.2.2)
|
|
@@ -98,75 +144,142 @@ GEM
|
|
|
98
144
|
activerecord
|
|
99
145
|
kaminari-core (= 1.2.2)
|
|
100
146
|
kaminari-core (1.2.2)
|
|
101
|
-
|
|
147
|
+
language_server-protocol (3.17.0.5)
|
|
148
|
+
lint_roller (1.1.0)
|
|
149
|
+
logger (1.7.0)
|
|
150
|
+
loofah (2.25.0)
|
|
102
151
|
crass (~> 1.0.2)
|
|
103
|
-
nokogiri (>= 1.
|
|
104
|
-
mail (2.
|
|
152
|
+
nokogiri (>= 1.12.0)
|
|
153
|
+
mail (2.9.0)
|
|
154
|
+
logger
|
|
105
155
|
mini_mime (>= 0.1.1)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
156
|
+
net-imap
|
|
157
|
+
net-pop
|
|
158
|
+
net-smtp
|
|
159
|
+
marcel (1.1.0)
|
|
160
|
+
method_source (1.1.0)
|
|
161
|
+
mini_mime (1.1.5)
|
|
162
|
+
mini_portile2 (2.8.9)
|
|
163
|
+
minitest (5.27.0)
|
|
164
|
+
mutex_m (0.3.0)
|
|
165
|
+
net-imap (0.5.13)
|
|
166
|
+
date
|
|
167
|
+
net-protocol
|
|
168
|
+
net-pop (0.1.2)
|
|
169
|
+
net-protocol
|
|
170
|
+
net-protocol (0.2.2)
|
|
171
|
+
timeout
|
|
172
|
+
net-smtp (0.5.1)
|
|
173
|
+
net-protocol
|
|
174
|
+
nio4r (2.7.5)
|
|
175
|
+
nokogiri (1.18.10)
|
|
176
|
+
mini_portile2 (~> 2.8.2)
|
|
177
|
+
racc (~> 1.4)
|
|
178
|
+
nokogiri (1.18.10-arm64-darwin)
|
|
116
179
|
racc (~> 1.4)
|
|
117
|
-
|
|
180
|
+
parallel (1.27.0)
|
|
181
|
+
parser (3.3.10.1)
|
|
182
|
+
ast (~> 2.4.1)
|
|
183
|
+
racc
|
|
184
|
+
pp (0.6.3)
|
|
185
|
+
prettyprint
|
|
186
|
+
prettyprint (0.2.0)
|
|
187
|
+
prism (1.9.0)
|
|
188
|
+
pry (0.15.2)
|
|
118
189
|
coderay (~> 1.1)
|
|
119
190
|
method_source (~> 1.0)
|
|
120
|
-
pry-byebug (3.
|
|
121
|
-
byebug (~>
|
|
122
|
-
pry (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
191
|
+
pry-byebug (3.11.0)
|
|
192
|
+
byebug (~> 12.0)
|
|
193
|
+
pry (>= 0.13, < 0.16)
|
|
194
|
+
psych (5.3.1)
|
|
195
|
+
date
|
|
196
|
+
stringio
|
|
197
|
+
racc (1.8.1)
|
|
198
|
+
rack (3.2.4)
|
|
199
|
+
rack-session (2.1.1)
|
|
200
|
+
base64 (>= 0.1.0)
|
|
201
|
+
rack (>= 3.0.0)
|
|
202
|
+
rack-test (2.2.0)
|
|
203
|
+
rack (>= 1.3)
|
|
204
|
+
rackup (2.3.1)
|
|
205
|
+
rack (>= 3)
|
|
206
|
+
rails (7.1.6)
|
|
207
|
+
actioncable (= 7.1.6)
|
|
208
|
+
actionmailbox (= 7.1.6)
|
|
209
|
+
actionmailer (= 7.1.6)
|
|
210
|
+
actionpack (= 7.1.6)
|
|
211
|
+
actiontext (= 7.1.6)
|
|
212
|
+
actionview (= 7.1.6)
|
|
213
|
+
activejob (= 7.1.6)
|
|
214
|
+
activemodel (= 7.1.6)
|
|
215
|
+
activerecord (= 7.1.6)
|
|
216
|
+
activestorage (= 7.1.6)
|
|
217
|
+
activesupport (= 7.1.6)
|
|
218
|
+
bundler (>= 1.15.0)
|
|
219
|
+
railties (= 7.1.6)
|
|
220
|
+
rails-dom-testing (2.3.0)
|
|
221
|
+
activesupport (>= 5.0.0)
|
|
222
|
+
minitest
|
|
142
223
|
nokogiri (>= 1.6)
|
|
143
|
-
rails-html-sanitizer (1.
|
|
144
|
-
loofah (~> 2.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
224
|
+
rails-html-sanitizer (1.6.2)
|
|
225
|
+
loofah (~> 2.21)
|
|
226
|
+
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)
|
|
227
|
+
railties (7.1.6)
|
|
228
|
+
actionpack (= 7.1.6)
|
|
229
|
+
activesupport (= 7.1.6)
|
|
230
|
+
cgi
|
|
231
|
+
irb
|
|
232
|
+
rackup (>= 1.0.0)
|
|
233
|
+
rake (>= 12.2)
|
|
234
|
+
thor (~> 1.0, >= 1.2.2)
|
|
235
|
+
tsort (>= 0.2)
|
|
236
|
+
zeitwerk (~> 2.6)
|
|
237
|
+
rainbow (3.1.1)
|
|
238
|
+
rake (13.3.1)
|
|
152
239
|
rb-readline (0.5.5)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
240
|
+
rdoc (7.1.0)
|
|
241
|
+
erb
|
|
242
|
+
psych (>= 4.0.0)
|
|
243
|
+
tsort
|
|
244
|
+
regexp_parser (2.11.3)
|
|
245
|
+
reline (0.6.3)
|
|
246
|
+
io-console (~> 0.5)
|
|
247
|
+
rspec-core (3.13.6)
|
|
248
|
+
rspec-support (~> 3.13.0)
|
|
249
|
+
rspec-expectations (3.13.5)
|
|
156
250
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
157
|
-
rspec-support (~> 3.
|
|
158
|
-
rspec-mocks (3.
|
|
251
|
+
rspec-support (~> 3.13.0)
|
|
252
|
+
rspec-mocks (3.13.7)
|
|
159
253
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
160
|
-
rspec-support (~> 3.
|
|
161
|
-
rspec-rails (
|
|
162
|
-
actionpack (>=
|
|
163
|
-
activesupport (>=
|
|
164
|
-
railties (>=
|
|
165
|
-
rspec-core (~> 3.
|
|
166
|
-
rspec-expectations (~> 3.
|
|
167
|
-
rspec-mocks (~> 3.
|
|
168
|
-
rspec-support (~> 3.
|
|
169
|
-
rspec-support (3.
|
|
254
|
+
rspec-support (~> 3.13.0)
|
|
255
|
+
rspec-rails (6.1.5)
|
|
256
|
+
actionpack (>= 6.1)
|
|
257
|
+
activesupport (>= 6.1)
|
|
258
|
+
railties (>= 6.1)
|
|
259
|
+
rspec-core (~> 3.13)
|
|
260
|
+
rspec-expectations (~> 3.13)
|
|
261
|
+
rspec-mocks (~> 3.13)
|
|
262
|
+
rspec-support (~> 3.13)
|
|
263
|
+
rspec-support (3.13.7)
|
|
264
|
+
rubocop (1.82.1)
|
|
265
|
+
json (~> 2.3)
|
|
266
|
+
language_server-protocol (~> 3.17.0.2)
|
|
267
|
+
lint_roller (~> 1.1.0)
|
|
268
|
+
parallel (~> 1.10)
|
|
269
|
+
parser (>= 3.3.0.2)
|
|
270
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
271
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
272
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
273
|
+
ruby-progressbar (~> 1.7)
|
|
274
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
275
|
+
rubocop-ast (1.49.0)
|
|
276
|
+
parser (>= 3.3.7.2)
|
|
277
|
+
prism (~> 1.7)
|
|
278
|
+
rubocop-performance (1.26.1)
|
|
279
|
+
lint_roller (~> 1.1)
|
|
280
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
281
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
282
|
+
ruby-progressbar (1.13.0)
|
|
170
283
|
sassc (2.4.0)
|
|
171
284
|
ffi (~> 1.9)
|
|
172
285
|
sassc-rails (2.1.2)
|
|
@@ -175,40 +288,63 @@ GEM
|
|
|
175
288
|
sprockets (> 3.0)
|
|
176
289
|
sprockets-rails
|
|
177
290
|
tilt
|
|
291
|
+
securerandom (0.4.1)
|
|
178
292
|
selectize-rails (0.12.6)
|
|
179
|
-
sprockets (4.
|
|
293
|
+
sprockets (4.2.2)
|
|
180
294
|
concurrent-ruby (~> 1.0)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
295
|
+
logger
|
|
296
|
+
rack (>= 2.2.4, < 4)
|
|
297
|
+
sprockets-rails (3.5.2)
|
|
298
|
+
actionpack (>= 6.1)
|
|
299
|
+
activesupport (>= 6.1)
|
|
185
300
|
sprockets (>= 3.0.0)
|
|
186
|
-
sqlite3 (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
301
|
+
sqlite3 (2.8.1)
|
|
302
|
+
mini_portile2 (~> 2.8.0)
|
|
303
|
+
sqlite3 (2.8.1-arm64-darwin)
|
|
304
|
+
standard (1.53.0)
|
|
305
|
+
language_server-protocol (~> 3.17.0.2)
|
|
306
|
+
lint_roller (~> 1.0)
|
|
307
|
+
rubocop (~> 1.82.0)
|
|
308
|
+
standard-custom (~> 1.0.0)
|
|
309
|
+
standard-performance (~> 1.8)
|
|
310
|
+
standard-custom (1.0.2)
|
|
311
|
+
lint_roller (~> 1.0)
|
|
312
|
+
rubocop (~> 1.50)
|
|
313
|
+
standard-performance (1.9.0)
|
|
314
|
+
lint_roller (~> 1.1)
|
|
315
|
+
rubocop-performance (~> 1.26.0)
|
|
316
|
+
stringio (3.2.0)
|
|
317
|
+
thor (1.5.0)
|
|
318
|
+
tilt (2.7.0)
|
|
319
|
+
timeout (0.6.0)
|
|
320
|
+
tsort (0.2.0)
|
|
321
|
+
tzinfo (2.0.6)
|
|
322
|
+
concurrent-ruby (~> 1.0)
|
|
323
|
+
unicode-display_width (3.2.0)
|
|
324
|
+
unicode-emoji (~> 4.1)
|
|
325
|
+
unicode-emoji (4.2.0)
|
|
326
|
+
websocket-driver (0.8.0)
|
|
327
|
+
base64
|
|
193
328
|
websocket-extensions (>= 0.1.0)
|
|
194
329
|
websocket-extensions (0.1.5)
|
|
330
|
+
yard (0.9.38)
|
|
331
|
+
zeitwerk (2.6.18)
|
|
195
332
|
|
|
196
333
|
PLATFORMS
|
|
334
|
+
arm64-darwin
|
|
197
335
|
ruby
|
|
198
336
|
|
|
199
337
|
DEPENDENCIES
|
|
200
|
-
administrate (~> 0.
|
|
201
|
-
administrate-field-enumerate
|
|
338
|
+
administrate (~> 0.19.0)
|
|
202
339
|
administrate_exportable!
|
|
203
340
|
byebug
|
|
204
341
|
pry-byebug
|
|
205
|
-
rails (~>
|
|
342
|
+
rails (~> 7.1.0)
|
|
206
343
|
rb-readline
|
|
207
|
-
rspec-rails (~>
|
|
344
|
+
rspec-rails (~> 6.0)
|
|
208
345
|
sqlite3
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
ruby 2.7.2p137
|
|
346
|
+
standard
|
|
347
|
+
yard
|
|
212
348
|
|
|
213
349
|
BUNDLED WITH
|
|
214
|
-
2.
|
|
350
|
+
2.5.11
|
data/README.md
CHANGED
|
@@ -17,15 +17,19 @@ Or install it yourself as:
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
19
|
For each resource you want to be exportable, add the following line to the their respective Administrate controller.
|
|
20
|
+
|
|
20
21
|
```ruby
|
|
21
22
|
include AdministrateExportable::Exporter
|
|
22
23
|
```
|
|
24
|
+
|
|
23
25
|
and the following line in the `config/routes.rb` file, correctly nested on resources
|
|
26
|
+
|
|
24
27
|
```ruby
|
|
25
28
|
get :export, on: :collection
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
Example:
|
|
32
|
+
|
|
29
33
|
```ruby
|
|
30
34
|
namespace :admin do
|
|
31
35
|
resources :organizations do
|
|
@@ -37,6 +41,7 @@ namespace :admin do
|
|
|
37
41
|
By default all the attributes from `ATTRIBUTE_TYPES` will be exported. If you want to exclude an attribute, you can use the option: `export: false`.
|
|
38
42
|
|
|
39
43
|
Example:
|
|
44
|
+
|
|
40
45
|
```ruby
|
|
41
46
|
class BusinessDashboard < Administrate::BaseDashboard
|
|
42
47
|
ATTRIBUTE_TYPES = {
|
|
@@ -49,14 +54,16 @@ class BusinessDashboard < Administrate::BaseDashboard
|
|
|
49
54
|
For the default field types from Administrate, we export the values you got from the partial `views/fields/index`. And if it is a custom field, we just run `field.to_s`.
|
|
50
55
|
But if you want to specify the value to be exported, you can use the option `transform_on_export`, to pass a `Proc` that receives the `field`.
|
|
51
56
|
Example:
|
|
57
|
+
|
|
52
58
|
```ruby
|
|
53
59
|
ATTRIBUTE_TYPES = {
|
|
54
60
|
created_at: Field::DateTime.with_options(transform_on_export: -> (field) { field.data.strftime("%F") })
|
|
55
61
|
```
|
|
56
62
|
|
|
57
63
|
By default the gem adds the Export button to the partial `views/admin/application/_index_header.html.erb`. But if you have your own Administrate `index` views or override that partial in your application you can add the link manually:
|
|
64
|
+
|
|
58
65
|
```ruby
|
|
59
|
-
link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if
|
|
66
|
+
link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if existing_action?(resource_class, :export)
|
|
60
67
|
```
|
|
61
68
|
|
|
62
69
|
Example:
|
|
@@ -71,17 +78,41 @@ Example:
|
|
|
71
78
|
),
|
|
72
79
|
[:new, namespace.to_sym, page.resource_path.to_sym],
|
|
73
80
|
class: "button",
|
|
74
|
-
) if
|
|
81
|
+
) if existing_action?(resource_class, :new) && authorized_action?(new_resource, :new) %>
|
|
75
82
|
|
|
76
83
|
<%= link_to(
|
|
77
84
|
'Export',
|
|
78
85
|
[:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
|
79
86
|
class: 'button'
|
|
80
|
-
) if
|
|
87
|
+
) if existing_action?(resource_class, :export) %>
|
|
81
88
|
</div>
|
|
82
89
|
....
|
|
83
90
|
```
|
|
84
91
|
|
|
92
|
+
### Using with Pundit
|
|
93
|
+
|
|
94
|
+
If you are using [Pundit](https://github.com/varvet/pundit) in your project you will receive an error saying `undefined method 'export?' for #<Admin::OrganizationPolicy>`. This is because the `export` action is not defined in the policy.
|
|
95
|
+
|
|
96
|
+
To fix this issue you need to add the `export` action to the policy and define the logic for who can export the resource.
|
|
97
|
+
|
|
98
|
+
Example:
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
module Admin
|
|
102
|
+
class OrganizationPolicy < ApplicationPolicy
|
|
103
|
+
# ... other methods ...
|
|
104
|
+
|
|
105
|
+
def export?
|
|
106
|
+
# Define the logic for who can export organizations
|
|
107
|
+
# For example, allow only admins to export:
|
|
108
|
+
user.admin?
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# ... other methods ...
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
```
|
|
115
|
+
|
|
85
116
|
## Development
|
|
86
117
|
|
|
87
118
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require "administrate_exportable/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name
|
|
8
|
-
spec.version
|
|
9
|
-
spec.authors
|
|
10
|
-
spec.email
|
|
11
|
-
spec.homepage
|
|
12
|
-
spec.summary
|
|
13
|
-
spec.description
|
|
14
|
-
spec.license
|
|
6
|
+
spec.name = "administrate_exportable"
|
|
7
|
+
spec.version = AdministrateExportable::VERSION
|
|
8
|
+
spec.authors = ["Jônatas Rancan", "Andrei Bondarev"]
|
|
9
|
+
spec.email = ["hello@sourcelabs.io"]
|
|
10
|
+
spec.homepage = "https://github.com/SourceLabsLLC/administrate_exportable"
|
|
11
|
+
spec.summary = "Simple plugin to add CSV export feature to Administrate"
|
|
12
|
+
spec.description = spec.summary
|
|
13
|
+
spec.license = "MIT"
|
|
15
14
|
|
|
16
15
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
16
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
@@ -22,19 +21,20 @@ Gem::Specification.new do |spec|
|
|
|
22
21
|
# "public gem pushes."
|
|
23
22
|
# end
|
|
24
23
|
|
|
25
|
-
spec.files
|
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
26
25
|
f.match(%r{^(test|spec|features)/})
|
|
27
26
|
end
|
|
28
|
-
spec.bindir
|
|
29
|
-
spec.executables
|
|
27
|
+
spec.bindir = "exe"
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
29
|
spec.require_paths = ["lib"]
|
|
31
30
|
|
|
32
31
|
spec.add_development_dependency "bundler", "~> 1.16"
|
|
33
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
34
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
35
34
|
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
|
36
|
-
spec.add_dependency
|
|
37
|
-
spec.add_dependency
|
|
38
|
-
spec.add_dependency
|
|
39
|
-
spec.add_dependency
|
|
35
|
+
spec.add_dependency "administrate", ">= 0.17.0"
|
|
36
|
+
spec.add_dependency "rails", ">= 4.2"
|
|
37
|
+
spec.add_dependency "actionview", ">= 5.2.2.1"
|
|
38
|
+
spec.add_dependency "railties", ">= 5.2.2.1"
|
|
39
|
+
spec.add_dependency "csv", "~> 3.0"
|
|
40
40
|
end
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
[:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
|
31
31
|
class: 'button',
|
|
32
32
|
target: '_blank'
|
|
33
|
-
) if
|
|
33
|
+
) if existing_action?(resource_class, :export) && authorized_action?(resource_name, :export) %>
|
|
34
34
|
</div>
|
|
35
35
|
</header>
|
|
@@ -11,8 +11,8 @@ module AdministrateExportable
|
|
|
11
11
|
define_method(:export) do
|
|
12
12
|
search_term = params[:search].to_s.strip
|
|
13
13
|
resources = Administrate::Search.new(scoped_resource,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
dashboard,
|
|
15
|
+
search_term).run
|
|
16
16
|
resources = apply_collection_includes(resources)
|
|
17
17
|
resources = order.apply(resources)
|
|
18
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "csv"
|
|
2
2
|
|
|
3
3
|
module AdministrateExportable
|
|
4
4
|
class ExporterService
|
|
@@ -14,7 +14,6 @@ module AdministrateExportable
|
|
|
14
14
|
|
|
15
15
|
def csv
|
|
16
16
|
CSV.generate(headers: true) do |csv|
|
|
17
|
-
|
|
18
17
|
csv << headers
|
|
19
18
|
|
|
20
19
|
collection.find_each do |record|
|
|
@@ -30,7 +29,7 @@ module AdministrateExportable
|
|
|
30
29
|
attr_reader :dashboard, :resource_class, :resources, :sanitizer
|
|
31
30
|
|
|
32
31
|
def record_attribute(record, attribute_key, attribute_type)
|
|
33
|
-
field = attribute_type.new(attribute_key, record.send(attribute_key),
|
|
32
|
+
field = attribute_type.new(attribute_key, record.send(attribute_key), "index", resource: record)
|
|
34
33
|
transform_on_export = attribute_type.respond_to?(:options) && attribute_type.options[:transform_on_export]
|
|
35
34
|
|
|
36
35
|
if transform_on_export.is_a? Proc
|
|
@@ -41,7 +40,7 @@ module AdministrateExportable
|
|
|
41
40
|
when Administrate::Field::BelongsTo.to_s, Administrate::Field::HasOne.to_s, Administrate::Field::Polymorphic.to_s
|
|
42
41
|
field.display_associated_resource if field.data
|
|
43
42
|
when Administrate::Field::HasMany.to_s
|
|
44
|
-
field.data
|
|
43
|
+
field.data&.count
|
|
45
44
|
when Administrate::Field::DateTime.to_s
|
|
46
45
|
field.datetime if field.data
|
|
47
46
|
when Administrate::Field::Date.to_s
|
|
@@ -61,24 +60,22 @@ module AdministrateExportable
|
|
|
61
60
|
attributes_to_export.map do |attribute_key, _|
|
|
62
61
|
attr_key = attribute_key.to_s
|
|
63
62
|
|
|
64
|
-
if attr_key.include?(
|
|
63
|
+
if attr_key.include?("_id")
|
|
65
64
|
attr_key
|
|
66
65
|
else
|
|
67
|
-
|
|
66
|
+
I18n.t(
|
|
68
67
|
"helpers.label.#{resource_class.name.downcase}.#{attr_key}",
|
|
69
|
-
default: attr_key
|
|
68
|
+
default: attr_key
|
|
70
69
|
).titleize
|
|
71
70
|
end
|
|
72
71
|
end
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
def attributes_to_export
|
|
76
|
-
@attributes_to_export ||=
|
|
77
|
-
|
|
78
|
-
attribute_options = attribute_type.try(:options)
|
|
75
|
+
@attributes_to_export ||= dashboard.class::ATTRIBUTE_TYPES.select do |attribute_key, attribute_type|
|
|
76
|
+
attribute_options = attribute_type.try(:options)
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
end
|
|
78
|
+
!attribute_options || attribute_options[:export] != false
|
|
82
79
|
end
|
|
83
80
|
end
|
|
84
81
|
|
|
@@ -4,7 +4,7 @@ require "administrate_exportable/exporter"
|
|
|
4
4
|
require "administrate/version"
|
|
5
5
|
|
|
6
6
|
module AdministrateExportable
|
|
7
|
-
PAGE_PARAM = Gem::Version.create(Administrate::VERSION) >= Gem::Version.create(
|
|
7
|
+
PAGE_PARAM = (Gem::Version.create(Administrate::VERSION) >= Gem::Version.create("0.15.0")) ? "_page" : "page"
|
|
8
8
|
|
|
9
9
|
class Engine < ::Rails::Engine
|
|
10
10
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: administrate_exportable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jônatas Rancan
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-03-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -123,6 +123,20 @@ dependencies:
|
|
|
123
123
|
- - ">="
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
125
|
version: 5.2.2.1
|
|
126
|
+
- !ruby/object:Gem::Dependency
|
|
127
|
+
name: csv
|
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
|
129
|
+
requirements:
|
|
130
|
+
- - "~>"
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '3.0'
|
|
133
|
+
type: :runtime
|
|
134
|
+
prerelease: false
|
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
136
|
+
requirements:
|
|
137
|
+
- - "~>"
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: '3.0'
|
|
126
140
|
description: Simple plugin to add CSV export feature to Administrate
|
|
127
141
|
email:
|
|
128
142
|
- hello@sourcelabs.io
|
|
@@ -130,6 +144,7 @@ executables: []
|
|
|
130
144
|
extensions: []
|
|
131
145
|
extra_rdoc_files: []
|
|
132
146
|
files:
|
|
147
|
+
- ".github/workflows/ci.yml"
|
|
133
148
|
- ".gitignore"
|
|
134
149
|
- ".rspec"
|
|
135
150
|
- ".tool-versions"
|
|
@@ -167,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
182
|
- !ruby/object:Gem::Version
|
|
168
183
|
version: '0'
|
|
169
184
|
requirements: []
|
|
170
|
-
rubygems_version: 3.
|
|
185
|
+
rubygems_version: 3.3.27
|
|
171
186
|
signing_key:
|
|
172
187
|
specification_version: 4
|
|
173
188
|
summary: Simple plugin to add CSV export feature to Administrate
|