administrate_exportable 0.1.2 → 0.5.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/.tool-versions +1 -0
- data/Gemfile.lock +92 -96
- data/README.md +8 -3
- data/administrate_exportable.gemspec +2 -1
- data/app/views/admin/application/index.html.erb +4 -4
- data/lib/administrate_exportable.rb +3 -0
- data/lib/administrate_exportable/exporter.rb +8 -1
- data/lib/administrate_exportable/exporter_service.rb +8 -10
- data/lib/administrate_exportable/version.rb +1 -1
- metadata +25 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d9744acc6ec1cc1b8ca19110d71e953299593d2843291aeef6b008cdeb017be
|
|
4
|
+
data.tar.gz: b32df982094216cd7e748912ef4ea3aa431734e923a5e8ed0eaffd3506eb1248
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 531eeed10c37bdb24df6a4f44e19bdf618f3602bb25fe84cc941592e5f5cce125d2f9e37725cb4108383f4a7154d2848fd5fe6358412f5275637c5be872955d4
|
|
7
|
+
data.tar.gz: bac05ea3431679fb7677d20c92d4fb479c4f88efae0de16724bec1c511a8ec04d306d161aa2da5f9b467e8ef451ad60d593b02966d4c7304762caf38716e985b
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 2.7.2
|
data/Gemfile.lock
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
administrate_exportable (0.1
|
|
4
|
+
administrate_exportable (0.3.1)
|
|
5
5
|
actionview (>= 5.2.2.1)
|
|
6
|
-
administrate (
|
|
6
|
+
administrate (>= 0.13.0)
|
|
7
7
|
rails (>= 4.2)
|
|
8
8
|
railties (>= 5.2.2.1)
|
|
9
9
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
actioncable (5.2.
|
|
14
|
-
actionpack (= 5.2.
|
|
13
|
+
actioncable (5.2.4.5)
|
|
14
|
+
actionpack (= 5.2.4.5)
|
|
15
15
|
nio4r (~> 2.0)
|
|
16
16
|
websocket-driver (>= 0.6.1)
|
|
17
|
-
actionmailer (5.2.
|
|
18
|
-
actionpack (= 5.2.
|
|
19
|
-
actionview (= 5.2.
|
|
20
|
-
activejob (= 5.2.
|
|
17
|
+
actionmailer (5.2.4.5)
|
|
18
|
+
actionpack (= 5.2.4.5)
|
|
19
|
+
actionview (= 5.2.4.5)
|
|
20
|
+
activejob (= 5.2.4.5)
|
|
21
21
|
mail (~> 2.5, >= 2.5.4)
|
|
22
22
|
rails-dom-testing (~> 2.0)
|
|
23
|
-
actionpack (5.2.
|
|
24
|
-
actionview (= 5.2.
|
|
25
|
-
activesupport (= 5.2.
|
|
26
|
-
rack (~> 2.0)
|
|
23
|
+
actionpack (5.2.4.5)
|
|
24
|
+
actionview (= 5.2.4.5)
|
|
25
|
+
activesupport (= 5.2.4.5)
|
|
26
|
+
rack (~> 2.0, >= 2.0.8)
|
|
27
27
|
rack-test (>= 0.6.3)
|
|
28
28
|
rails-dom-testing (~> 2.0)
|
|
29
29
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
30
|
-
actionview (5.2.
|
|
31
|
-
activesupport (= 5.2.
|
|
30
|
+
actionview (5.2.4.5)
|
|
31
|
+
activesupport (= 5.2.4.5)
|
|
32
32
|
builder (~> 3.1)
|
|
33
33
|
erubi (~> 1.4)
|
|
34
34
|
rails-dom-testing (~> 2.0)
|
|
35
35
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
36
|
-
activejob (5.2.
|
|
37
|
-
activesupport (= 5.2.
|
|
36
|
+
activejob (5.2.4.5)
|
|
37
|
+
activesupport (= 5.2.4.5)
|
|
38
38
|
globalid (>= 0.3.6)
|
|
39
|
-
activemodel (5.2.
|
|
40
|
-
activesupport (= 5.2.
|
|
41
|
-
activerecord (5.2.
|
|
42
|
-
activemodel (= 5.2.
|
|
43
|
-
activesupport (= 5.2.
|
|
39
|
+
activemodel (5.2.4.5)
|
|
40
|
+
activesupport (= 5.2.4.5)
|
|
41
|
+
activerecord (5.2.4.5)
|
|
42
|
+
activemodel (= 5.2.4.5)
|
|
43
|
+
activesupport (= 5.2.4.5)
|
|
44
44
|
arel (>= 9.0)
|
|
45
|
-
activestorage (5.2.
|
|
46
|
-
actionpack (= 5.2.
|
|
47
|
-
activerecord (= 5.2.
|
|
45
|
+
activestorage (5.2.4.5)
|
|
46
|
+
actionpack (= 5.2.4.5)
|
|
47
|
+
activerecord (= 5.2.4.5)
|
|
48
48
|
marcel (~> 0.3.1)
|
|
49
|
-
activesupport (5.2.
|
|
49
|
+
activesupport (5.2.4.5)
|
|
50
50
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
51
51
|
i18n (>= 0.7, < 2)
|
|
52
52
|
minitest (~> 5.1)
|
|
53
53
|
tzinfo (~> 1.1)
|
|
54
|
-
administrate (0.
|
|
55
|
-
actionpack (>= 4.2
|
|
56
|
-
actionview (>= 4.2
|
|
57
|
-
activerecord (>= 4.2
|
|
54
|
+
administrate (0.13.0)
|
|
55
|
+
actionpack (>= 4.2)
|
|
56
|
+
actionview (>= 4.2)
|
|
57
|
+
activerecord (>= 4.2)
|
|
58
58
|
autoprefixer-rails (>= 6.0)
|
|
59
59
|
datetime_picker_rails (~> 0.0.7)
|
|
60
60
|
jquery-rails (>= 4.0)
|
|
61
61
|
kaminari (>= 1.0)
|
|
62
62
|
momentjs-rails (~> 2.8)
|
|
63
|
-
|
|
63
|
+
sassc-rails (~> 2.1)
|
|
64
64
|
selectize-rails (~> 0.6)
|
|
65
65
|
administrate-field-enumerate (0.0.1)
|
|
66
66
|
administrate
|
|
67
67
|
enumerate_it
|
|
68
68
|
rails (>= 4.2, < 6.0)
|
|
69
69
|
arel (9.0.0)
|
|
70
|
-
autoprefixer-rails (
|
|
70
|
+
autoprefixer-rails (10.2.4.0)
|
|
71
71
|
execjs
|
|
72
|
-
builder (3.2.
|
|
72
|
+
builder (3.2.4)
|
|
73
73
|
byebug (11.0.1)
|
|
74
74
|
coderay (1.1.2)
|
|
75
|
-
concurrent-ruby (1.1.
|
|
76
|
-
crass (1.0.
|
|
75
|
+
concurrent-ruby (1.1.8)
|
|
76
|
+
crass (1.0.6)
|
|
77
77
|
datetime_picker_rails (0.0.7)
|
|
78
78
|
momentjs-rails (>= 2.8.1)
|
|
79
79
|
diff-lcs (1.3)
|
|
80
80
|
enumerate_it (2.0.0)
|
|
81
81
|
activesupport (>= 4.0.0)
|
|
82
|
-
erubi (1.
|
|
82
|
+
erubi (1.10.0)
|
|
83
83
|
execjs (2.7.0)
|
|
84
|
-
ffi (1.
|
|
84
|
+
ffi (1.15.0)
|
|
85
85
|
globalid (0.4.2)
|
|
86
86
|
activesupport (>= 4.2.0)
|
|
87
|
-
i18n (1.
|
|
87
|
+
i18n (1.8.9)
|
|
88
88
|
concurrent-ruby (~> 1.0)
|
|
89
|
-
jquery-rails (4.
|
|
89
|
+
jquery-rails (4.4.0)
|
|
90
90
|
rails-dom-testing (>= 1, < 3)
|
|
91
91
|
railties (>= 4.2.0)
|
|
92
92
|
thor (>= 0.14, < 2.0)
|
|
93
|
-
kaminari (1.
|
|
93
|
+
kaminari (1.2.1)
|
|
94
94
|
activesupport (>= 4.1.0)
|
|
95
|
-
kaminari-actionview (= 1.
|
|
96
|
-
kaminari-activerecord (= 1.
|
|
97
|
-
kaminari-core (= 1.
|
|
98
|
-
kaminari-actionview (1.
|
|
95
|
+
kaminari-actionview (= 1.2.1)
|
|
96
|
+
kaminari-activerecord (= 1.2.1)
|
|
97
|
+
kaminari-core (= 1.2.1)
|
|
98
|
+
kaminari-actionview (1.2.1)
|
|
99
99
|
actionview
|
|
100
|
-
kaminari-core (= 1.
|
|
101
|
-
kaminari-activerecord (1.
|
|
100
|
+
kaminari-core (= 1.2.1)
|
|
101
|
+
kaminari-activerecord (1.2.1)
|
|
102
102
|
activerecord
|
|
103
|
-
kaminari-core (= 1.
|
|
104
|
-
kaminari-core (1.
|
|
105
|
-
loofah (2.
|
|
103
|
+
kaminari-core (= 1.2.1)
|
|
104
|
+
kaminari-core (1.2.1)
|
|
105
|
+
loofah (2.9.0)
|
|
106
106
|
crass (~> 1.0.2)
|
|
107
107
|
nokogiri (>= 1.5.9)
|
|
108
108
|
mail (2.7.1)
|
|
@@ -110,52 +110,51 @@ GEM
|
|
|
110
110
|
marcel (0.3.3)
|
|
111
111
|
mimemagic (~> 0.3.2)
|
|
112
112
|
method_source (0.9.2)
|
|
113
|
-
mimemagic (0.3.
|
|
113
|
+
mimemagic (0.3.5)
|
|
114
114
|
mini_mime (1.0.2)
|
|
115
|
-
mini_portile2 (2.
|
|
116
|
-
minitest (5.
|
|
115
|
+
mini_portile2 (2.5.0)
|
|
116
|
+
minitest (5.14.4)
|
|
117
117
|
momentjs-rails (2.20.1)
|
|
118
118
|
railties (>= 3.1)
|
|
119
|
-
nio4r (2.
|
|
120
|
-
nokogiri (1.
|
|
121
|
-
mini_portile2 (~> 2.
|
|
119
|
+
nio4r (2.5.7)
|
|
120
|
+
nokogiri (1.11.1)
|
|
121
|
+
mini_portile2 (~> 2.5.0)
|
|
122
|
+
racc (~> 1.4)
|
|
122
123
|
pry (0.12.2)
|
|
123
124
|
coderay (~> 1.1.0)
|
|
124
125
|
method_source (~> 0.9.0)
|
|
125
126
|
pry-byebug (3.7.0)
|
|
126
127
|
byebug (~> 11.0)
|
|
127
128
|
pry (~> 0.10)
|
|
128
|
-
|
|
129
|
+
racc (1.5.2)
|
|
130
|
+
rack (2.2.3)
|
|
129
131
|
rack-test (1.1.0)
|
|
130
132
|
rack (>= 1.0, < 3)
|
|
131
|
-
rails (5.2.
|
|
132
|
-
actioncable (= 5.2.
|
|
133
|
-
actionmailer (= 5.2.
|
|
134
|
-
actionpack (= 5.2.
|
|
135
|
-
actionview (= 5.2.
|
|
136
|
-
activejob (= 5.2.
|
|
137
|
-
activemodel (= 5.2.
|
|
138
|
-
activerecord (= 5.2.
|
|
139
|
-
activestorage (= 5.2.
|
|
140
|
-
activesupport (= 5.2.
|
|
133
|
+
rails (5.2.4.5)
|
|
134
|
+
actioncable (= 5.2.4.5)
|
|
135
|
+
actionmailer (= 5.2.4.5)
|
|
136
|
+
actionpack (= 5.2.4.5)
|
|
137
|
+
actionview (= 5.2.4.5)
|
|
138
|
+
activejob (= 5.2.4.5)
|
|
139
|
+
activemodel (= 5.2.4.5)
|
|
140
|
+
activerecord (= 5.2.4.5)
|
|
141
|
+
activestorage (= 5.2.4.5)
|
|
142
|
+
activesupport (= 5.2.4.5)
|
|
141
143
|
bundler (>= 1.3.0)
|
|
142
|
-
railties (= 5.2.
|
|
144
|
+
railties (= 5.2.4.5)
|
|
143
145
|
sprockets-rails (>= 2.0.0)
|
|
144
146
|
rails-dom-testing (2.0.3)
|
|
145
147
|
activesupport (>= 4.2.0)
|
|
146
148
|
nokogiri (>= 1.6)
|
|
147
|
-
rails-html-sanitizer (1.
|
|
148
|
-
loofah (~> 2.
|
|
149
|
-
railties (5.2.
|
|
150
|
-
actionpack (= 5.2.
|
|
151
|
-
activesupport (= 5.2.
|
|
149
|
+
rails-html-sanitizer (1.3.0)
|
|
150
|
+
loofah (~> 2.3)
|
|
151
|
+
railties (5.2.4.5)
|
|
152
|
+
actionpack (= 5.2.4.5)
|
|
153
|
+
activesupport (= 5.2.4.5)
|
|
152
154
|
method_source
|
|
153
155
|
rake (>= 0.8.7)
|
|
154
156
|
thor (>= 0.19.0, < 2.0)
|
|
155
|
-
rake (
|
|
156
|
-
rb-fsevent (0.10.3)
|
|
157
|
-
rb-inotify (0.10.0)
|
|
158
|
-
ffi (~> 1.0)
|
|
157
|
+
rake (13.0.3)
|
|
159
158
|
rb-readline (0.5.5)
|
|
160
159
|
rspec-core (3.8.2)
|
|
161
160
|
rspec-support (~> 3.8.0)
|
|
@@ -174,40 +173,37 @@ GEM
|
|
|
174
173
|
rspec-mocks (~> 3.8.0)
|
|
175
174
|
rspec-support (~> 3.8.0)
|
|
176
175
|
rspec-support (3.8.2)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
sprockets (>= 2.8, < 4.0)
|
|
186
|
-
sprockets-rails (>= 2.0, < 4.0)
|
|
187
|
-
tilt (>= 1.1, < 3)
|
|
176
|
+
sassc (2.4.0)
|
|
177
|
+
ffi (~> 1.9)
|
|
178
|
+
sassc-rails (2.1.2)
|
|
179
|
+
railties (>= 4.0.0)
|
|
180
|
+
sassc (>= 2.0)
|
|
181
|
+
sprockets (> 3.0)
|
|
182
|
+
sprockets-rails
|
|
183
|
+
tilt
|
|
188
184
|
selectize-rails (0.12.6)
|
|
189
|
-
sprockets (
|
|
185
|
+
sprockets (4.0.2)
|
|
190
186
|
concurrent-ruby (~> 1.0)
|
|
191
187
|
rack (> 1, < 3)
|
|
192
|
-
sprockets-rails (3.2.
|
|
188
|
+
sprockets-rails (3.2.2)
|
|
193
189
|
actionpack (>= 4.0)
|
|
194
190
|
activesupport (>= 4.0)
|
|
195
191
|
sprockets (>= 3.0.0)
|
|
196
192
|
sqlite3 (1.4.1)
|
|
197
|
-
thor (
|
|
193
|
+
thor (1.1.0)
|
|
198
194
|
thread_safe (0.3.6)
|
|
199
|
-
tilt (2.0.
|
|
200
|
-
tzinfo (1.2.
|
|
195
|
+
tilt (2.0.10)
|
|
196
|
+
tzinfo (1.2.9)
|
|
201
197
|
thread_safe (~> 0.1)
|
|
202
|
-
websocket-driver (0.7.
|
|
198
|
+
websocket-driver (0.7.3)
|
|
203
199
|
websocket-extensions (>= 0.1.0)
|
|
204
|
-
websocket-extensions (0.1.
|
|
200
|
+
websocket-extensions (0.1.5)
|
|
205
201
|
|
|
206
202
|
PLATFORMS
|
|
207
203
|
ruby
|
|
208
204
|
|
|
209
205
|
DEPENDENCIES
|
|
210
|
-
administrate
|
|
206
|
+
administrate (~> 0.13.0)
|
|
211
207
|
administrate-field-enumerate
|
|
212
208
|
administrate_exportable!
|
|
213
209
|
byebug
|
|
@@ -218,7 +214,7 @@ DEPENDENCIES
|
|
|
218
214
|
sqlite3
|
|
219
215
|
|
|
220
216
|
RUBY VERSION
|
|
221
|
-
ruby 2.
|
|
217
|
+
ruby 2.7.2p137
|
|
222
218
|
|
|
223
219
|
BUNDLED WITH
|
|
224
|
-
1.
|
|
220
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ For each resource you want to be exportable, add the following line to the their
|
|
|
20
20
|
```ruby
|
|
21
21
|
include AdministrateExportable::Exporter
|
|
22
22
|
```
|
|
23
|
-
and the following line in the `
|
|
23
|
+
and the following line in the `config/routes.rb` file, correctly nested on resources
|
|
24
24
|
```ruby
|
|
25
25
|
get :export, on: :collection
|
|
26
26
|
```
|
|
@@ -56,7 +56,7 @@ ATTRIBUTE_TYPES = {
|
|
|
56
56
|
|
|
57
57
|
By default the gem adds the Export button to the view `views/admin/application/index.html.erb`. But if you have your own Administrate `index` views, you can add the link manually:
|
|
58
58
|
```ruby
|
|
59
|
-
link_to('Export', [:export, namespace, page.resource_name.to_s.pluralize,
|
|
59
|
+
link_to('Export', [:export, namespace, page.resource_name.to_s.pluralize, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if valid_action?(:export)
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Example:
|
|
@@ -72,7 +72,12 @@ Example:
|
|
|
72
72
|
[:new, namespace, page.resource_path],
|
|
73
73
|
class: "button",
|
|
74
74
|
) if valid_action?(:new) && show_action?(:new, new_resource) %>
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
<%= link_to(
|
|
77
|
+
'Export',
|
|
78
|
+
[:export, namespace, page.resource_name.to_s.pluralize, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
|
79
|
+
class: 'button'
|
|
80
|
+
) if valid_action?(:export) %>
|
|
76
81
|
</div>
|
|
77
82
|
....
|
|
78
83
|
```
|
|
@@ -32,7 +32,8 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.16"
|
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
35
|
-
spec.
|
|
35
|
+
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
|
36
|
+
spec.add_dependency 'administrate','>= 0.13.0'
|
|
36
37
|
spec.add_dependency 'rails', '>= 4.2'
|
|
37
38
|
spec.add_dependency 'actionview', '>= 5.2.2.1'
|
|
38
39
|
spec.add_dependency 'railties', '>= 5.2.2.1'
|
|
@@ -42,14 +42,14 @@ It renders the `_table` partial to display details about the resources.
|
|
|
42
42
|
"administrate.actions.new_resource",
|
|
43
43
|
name: page.resource_name.titleize.downcase
|
|
44
44
|
),
|
|
45
|
-
[:new, namespace, page.resource_path],
|
|
45
|
+
[:new, namespace, page.resource_path.to_sym],
|
|
46
46
|
class: "button",
|
|
47
47
|
) if valid_action?(:new) && show_action?(:new, new_resource) %>
|
|
48
48
|
<%= link_to(
|
|
49
49
|
'Export',
|
|
50
|
-
[:export, namespace, page.resource_name.to_s.pluralize,
|
|
50
|
+
[:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
|
|
51
51
|
class: 'button'
|
|
52
|
-
) if valid_action?(:export) %>
|
|
52
|
+
) if valid_action?(:export) && show_action?(:export, resource_name) %>
|
|
53
53
|
</div>
|
|
54
54
|
</header>
|
|
55
55
|
|
|
@@ -63,5 +63,5 @@ It renders the `_table` partial to display details about the resources.
|
|
|
63
63
|
table_title: "page-title"
|
|
64
64
|
) %>
|
|
65
65
|
|
|
66
|
-
<%= paginate resources %>
|
|
66
|
+
<%= paginate resources, param_name: AdministrateExportable::PAGE_PARAM %>
|
|
67
67
|
</section>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
require "administrate_exportable/version"
|
|
2
2
|
require "administrate_exportable/exporter_service"
|
|
3
3
|
require "administrate_exportable/exporter"
|
|
4
|
+
require "administrate/version"
|
|
4
5
|
|
|
5
6
|
module AdministrateExportable
|
|
7
|
+
PAGE_PARAM = Gem::Version.create(Administrate::VERSION) >= Gem::Version.create('0.15.0') ? '_page' : 'page'
|
|
8
|
+
|
|
6
9
|
class Engine < ::Rails::Engine
|
|
7
10
|
end
|
|
8
11
|
end
|
|
@@ -9,7 +9,14 @@ module AdministrateExportable
|
|
|
9
9
|
class_methods do
|
|
10
10
|
def exportable
|
|
11
11
|
define_method(:export) do
|
|
12
|
-
|
|
12
|
+
search_term = params[:search].to_s.strip
|
|
13
|
+
resources = Administrate::Search.new(scoped_resource,
|
|
14
|
+
dashboard_class,
|
|
15
|
+
search_term).run
|
|
16
|
+
resources = apply_collection_includes(resources)
|
|
17
|
+
resources = order.apply(resources)
|
|
18
|
+
|
|
19
|
+
csv_data = ExporterService.csv(dashboard, resource_class, resources)
|
|
13
20
|
|
|
14
21
|
respond_to do |format|
|
|
15
22
|
format.csv { send_data csv_data, filename: "#{resource_name.to_s.pluralize}-#{Date.today}.csv" }
|
|
@@ -2,13 +2,14 @@ require 'csv'
|
|
|
2
2
|
|
|
3
3
|
module AdministrateExportable
|
|
4
4
|
class ExporterService
|
|
5
|
-
def self.csv(dashboard, resource_class)
|
|
6
|
-
new(dashboard, resource_class).csv
|
|
5
|
+
def self.csv(dashboard, resource_class, resources)
|
|
6
|
+
new(dashboard, resource_class, resources).csv
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def initialize(dashboard, resource_class)
|
|
9
|
+
def initialize(dashboard, resource_class, resources)
|
|
10
10
|
@dashboard = dashboard
|
|
11
11
|
@resource_class = resource_class
|
|
12
|
+
@resources = resources
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def csv
|
|
@@ -26,7 +27,7 @@ module AdministrateExportable
|
|
|
26
27
|
|
|
27
28
|
private
|
|
28
29
|
|
|
29
|
-
attr_reader :dashboard, :resource_class, :sanitizer
|
|
30
|
+
attr_reader :dashboard, :resource_class, :resources, :sanitizer
|
|
30
31
|
|
|
31
32
|
def record_attribute(record, attribute_key, attribute_type)
|
|
32
33
|
field = attribute_type.new(attribute_key, record.send(attribute_key), 'index', resource: record)
|
|
@@ -43,6 +44,8 @@ module AdministrateExportable
|
|
|
43
44
|
field.data.count if field.data
|
|
44
45
|
when Administrate::Field::DateTime.to_s
|
|
45
46
|
field.datetime if field.data
|
|
47
|
+
when Administrate::Field::Date.to_s
|
|
48
|
+
field.date if field.data
|
|
46
49
|
when Administrate::Field::Email.to_s, Administrate::Field::Select.to_s
|
|
47
50
|
field.data
|
|
48
51
|
when Administrate::Field::Password.to_s, Administrate::Field::String.to_s, Administrate::Field::Text.to_s
|
|
@@ -80,12 +83,7 @@ module AdministrateExportable
|
|
|
80
83
|
end
|
|
81
84
|
|
|
82
85
|
def collection
|
|
83
|
-
|
|
84
|
-
resource_includes = dashboard.collection_includes
|
|
85
|
-
|
|
86
|
-
return relation if resource_includes.empty?
|
|
87
|
-
|
|
88
|
-
relation.includes(*resource_includes)
|
|
86
|
+
resources
|
|
89
87
|
end
|
|
90
88
|
end
|
|
91
89
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: administrate_exportable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jônatas Rancan
|
|
8
8
|
- Andrei Bondarev
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-05-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -53,20 +53,34 @@ dependencies:
|
|
|
53
53
|
- - "~>"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '3.0'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: pry-byebug
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - "~>"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '3.0'
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - "~>"
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '3.0'
|
|
56
70
|
- !ruby/object:Gem::Dependency
|
|
57
71
|
name: administrate
|
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
|
59
73
|
requirements:
|
|
60
|
-
- - "
|
|
74
|
+
- - ">="
|
|
61
75
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 0.
|
|
76
|
+
version: 0.13.0
|
|
63
77
|
type: :runtime
|
|
64
78
|
prerelease: false
|
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
80
|
requirements:
|
|
67
|
-
- - "
|
|
81
|
+
- - ">="
|
|
68
82
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 0.
|
|
83
|
+
version: 0.13.0
|
|
70
84
|
- !ruby/object:Gem::Dependency
|
|
71
85
|
name: rails
|
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -118,6 +132,7 @@ extra_rdoc_files: []
|
|
|
118
132
|
files:
|
|
119
133
|
- ".gitignore"
|
|
120
134
|
- ".rspec"
|
|
135
|
+
- ".tool-versions"
|
|
121
136
|
- ".travis.yml"
|
|
122
137
|
- Gemfile
|
|
123
138
|
- Gemfile.lock
|
|
@@ -136,7 +151,7 @@ homepage: https://github.com/SourceLabsLLC/administrate_exportable
|
|
|
136
151
|
licenses:
|
|
137
152
|
- MIT
|
|
138
153
|
metadata: {}
|
|
139
|
-
post_install_message:
|
|
154
|
+
post_install_message:
|
|
140
155
|
rdoc_options: []
|
|
141
156
|
require_paths:
|
|
142
157
|
- lib
|
|
@@ -151,8 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
151
166
|
- !ruby/object:Gem::Version
|
|
152
167
|
version: '0'
|
|
153
168
|
requirements: []
|
|
154
|
-
rubygems_version: 3.
|
|
155
|
-
signing_key:
|
|
169
|
+
rubygems_version: 3.1.4
|
|
170
|
+
signing_key:
|
|
156
171
|
specification_version: 4
|
|
157
172
|
summary: Simple plugin to add CSV export feature to Administrate
|
|
158
173
|
test_files: []
|