activeadmin 2.3.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +106 -35
- data/CONTRIBUTING.md +50 -54
- data/README.md +1 -1
- data/app/assets/javascripts/active_admin/base.js +519 -0
- data/app/assets/stylesheets/active_admin/_base.scss +29 -29
- data/app/assets/stylesheets/active_admin/_header.scss +3 -5
- data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
- data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +0 -0
- data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
- data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +5 -0
- data/app/assets/stylesheets/active_admin/print.scss +2 -2
- data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
- data/app/javascript/active_admin/base.js +28 -0
- data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
- data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
- data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +4 -2
- data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
- data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
- data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
- data/app/javascript/active_admin/initializers/filters.js +10 -0
- data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +0 -0
- data/app/javascript/active_admin/initializers/per-page.js +13 -0
- data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
- data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
- data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +2 -2
- data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +2 -9
- data/app/javascript/active_admin/lib/filters.js +39 -0
- data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +3 -1
- data/app/javascript/active_admin/lib/per-page.js +38 -0
- data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +4 -2
- data/app/javascript/active_admin/lib/utils.js +40 -0
- data/config/locales/az.yml +138 -0
- data/config/locales/de.yml +18 -0
- data/config/locales/en-CA.yml +3 -3
- data/config/locales/en-GB.yml +3 -3
- data/config/locales/en.yml +3 -3
- data/config/locales/es.yml +3 -3
- data/config/locales/fr.yml +4 -4
- data/config/locales/lv.yml +2 -2
- data/config/locales/sk.yml +59 -0
- data/config/locales/vi.yml +1 -0
- data/docs/1-general-configuration.md +20 -0
- data/docs/3-index-pages.md +1 -1
- data/docs/9-batch-actions.md +2 -2
- data/docs/Gemfile.lock +103 -103
- data/lib/active_admin.rb +0 -1
- data/lib/active_admin/application.rb +1 -1
- data/lib/active_admin/csv_builder.rb +7 -3
- data/lib/active_admin/filters/active_filter.rb +1 -1
- data/lib/active_admin/filters/resource_extension.rb +24 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +15 -12
- data/lib/active_admin/localizers/resource_localizer.rb +1 -1
- data/lib/active_admin/namespace_settings.rb +13 -0
- data/lib/active_admin/order_clause.rb +1 -1
- data/lib/active_admin/resource.rb +1 -1
- data/lib/active_admin/resource/naming.rb +1 -1
- data/lib/active_admin/resource_controller/decorators.rb +2 -2
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +3 -2
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/views/components/paginated_collection.rb +2 -1
- data/lib/active_admin/views/components/table_for.rb +1 -0
- data/lib/active_admin/views/pages/base.rb +5 -3
- data/lib/active_admin/views/pages/index.rb +1 -0
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +14 -1
- metadata +35 -45
- data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
- data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
- data/app/assets/images/active_admin/orderable.png +0 -0
- data/app/assets/javascripts/active_admin/base.es6 +0 -23
- data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
- data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
- data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
data/docs/3-index-pages.md
CHANGED
data/docs/9-batch-actions.md
CHANGED
@@ -154,13 +154,13 @@ batch_action :doit, form: -> { {user: User.pluck(:name, :id)} } do |ids, inputs|
|
|
154
154
|
end
|
155
155
|
```
|
156
156
|
|
157
|
-
Under the covers this is powered by the JS `ActiveAdmin.
|
157
|
+
Under the covers this is powered by the JS `ActiveAdmin.ModalDialog` which you
|
158
158
|
can use yourself:
|
159
159
|
|
160
160
|
```coffee
|
161
161
|
if $('body.admin_users').length
|
162
162
|
$('a[data-prompt]').click ->
|
163
|
-
ActiveAdmin.
|
163
|
+
ActiveAdmin.ModalDialog $(@).data('prompt'), comment: 'textarea',
|
164
164
|
(inputs)=>
|
165
165
|
$.post "/admin/users/#{$(@).data 'id'}/change_state",
|
166
166
|
comment: inputs.comment, state: $(@).data('state'),
|
data/docs/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (
|
5
|
-
|
4
|
+
activesupport (6.0.2.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (>= 0.7, < 2)
|
6
7
|
minitest (~> 5.1)
|
7
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
8
8
|
tzinfo (~> 1.1)
|
9
|
-
|
10
|
-
|
9
|
+
zeitwerk (~> 2.2)
|
10
|
+
addressable (2.7.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
11
12
|
coffee-script (2.4.1)
|
12
13
|
coffee-script-source
|
13
14
|
execjs
|
@@ -15,43 +16,42 @@ GEM
|
|
15
16
|
colorator (1.1.0)
|
16
17
|
commonmarker (0.17.13)
|
17
18
|
ruby-enum (~> 0.5)
|
18
|
-
concurrent-ruby (1.
|
19
|
-
dnsruby (1.61.
|
19
|
+
concurrent-ruby (1.1.5)
|
20
|
+
dnsruby (1.61.3)
|
20
21
|
addressable (~> 2.5)
|
21
22
|
em-websocket (0.5.1)
|
22
23
|
eventmachine (>= 0.12.9)
|
23
24
|
http_parser.rb (~> 0.6.0)
|
24
|
-
ethon (0.
|
25
|
+
ethon (0.12.0)
|
25
26
|
ffi (>= 1.3.0)
|
26
27
|
eventmachine (1.2.7)
|
27
28
|
execjs (2.7.0)
|
28
|
-
faraday (0.
|
29
|
+
faraday (1.0.0)
|
29
30
|
multipart-post (>= 1.2, < 3)
|
30
|
-
ffi (1.
|
31
|
+
ffi (1.12.1)
|
31
32
|
forwardable-extended (2.6.0)
|
32
|
-
gemoji (3.0.
|
33
|
-
github-pages (
|
34
|
-
|
35
|
-
|
36
|
-
jekyll (=
|
37
|
-
jekyll-avatar (= 0.6.0)
|
33
|
+
gemoji (3.0.1)
|
34
|
+
github-pages (204)
|
35
|
+
github-pages-health-check (= 1.16.1)
|
36
|
+
jekyll (= 3.8.5)
|
37
|
+
jekyll-avatar (= 0.7.0)
|
38
38
|
jekyll-coffeescript (= 1.1.1)
|
39
|
-
jekyll-commonmark-ghpages (= 0.1.
|
39
|
+
jekyll-commonmark-ghpages (= 0.1.6)
|
40
40
|
jekyll-default-layout (= 0.1.4)
|
41
|
-
jekyll-feed (= 0.
|
41
|
+
jekyll-feed (= 0.13.0)
|
42
42
|
jekyll-gist (= 1.5.0)
|
43
|
-
jekyll-github-metadata (= 2.
|
44
|
-
jekyll-mentions (= 1.
|
45
|
-
jekyll-optional-front-matter (= 0.3.
|
43
|
+
jekyll-github-metadata (= 2.13.0)
|
44
|
+
jekyll-mentions (= 1.5.1)
|
45
|
+
jekyll-optional-front-matter (= 0.3.2)
|
46
46
|
jekyll-paginate (= 1.1.0)
|
47
|
-
jekyll-readme-index (= 0.
|
48
|
-
jekyll-redirect-from (= 0.
|
49
|
-
jekyll-relative-links (= 0.
|
50
|
-
jekyll-remote-theme (= 0.
|
47
|
+
jekyll-readme-index (= 0.3.0)
|
48
|
+
jekyll-redirect-from (= 0.15.0)
|
49
|
+
jekyll-relative-links (= 0.6.1)
|
50
|
+
jekyll-remote-theme (= 0.4.1)
|
51
51
|
jekyll-sass-converter (= 1.5.2)
|
52
|
-
jekyll-seo-tag (= 2.
|
53
|
-
jekyll-sitemap (= 1.
|
54
|
-
jekyll-swiss (= 0.
|
52
|
+
jekyll-seo-tag (= 2.6.1)
|
53
|
+
jekyll-sitemap (= 1.4.0)
|
54
|
+
jekyll-swiss (= 1.0.0)
|
55
55
|
jekyll-theme-architect (= 0.1.1)
|
56
56
|
jekyll-theme-cayman (= 0.1.1)
|
57
57
|
jekyll-theme-dinky (= 0.1.1)
|
@@ -61,33 +61,32 @@ GEM
|
|
61
61
|
jekyll-theme-midnight (= 0.1.1)
|
62
62
|
jekyll-theme-minimal (= 0.1.1)
|
63
63
|
jekyll-theme-modernist (= 0.1.1)
|
64
|
-
jekyll-theme-primer (= 0.5.
|
64
|
+
jekyll-theme-primer (= 0.5.4)
|
65
65
|
jekyll-theme-slate (= 0.1.1)
|
66
66
|
jekyll-theme-tactile (= 0.1.1)
|
67
67
|
jekyll-theme-time-machine (= 0.1.1)
|
68
|
-
jekyll-titles-from-headings (= 0.5.
|
69
|
-
jemoji (= 0.
|
68
|
+
jekyll-titles-from-headings (= 0.5.3)
|
69
|
+
jemoji (= 0.11.1)
|
70
70
|
kramdown (= 1.17.0)
|
71
|
-
liquid (= 4.0.
|
72
|
-
listen (= 3.1.5)
|
71
|
+
liquid (= 4.0.3)
|
73
72
|
mercenary (~> 0.3)
|
74
|
-
minima (= 2.5.
|
75
|
-
nokogiri (>= 1.
|
76
|
-
rouge (=
|
73
|
+
minima (= 2.5.1)
|
74
|
+
nokogiri (>= 1.10.4, < 2.0)
|
75
|
+
rouge (= 3.13.0)
|
77
76
|
terminal-table (~> 1.4)
|
78
|
-
github-pages-health-check (1.
|
77
|
+
github-pages-health-check (1.16.1)
|
79
78
|
addressable (~> 2.3)
|
80
79
|
dnsruby (~> 1.60)
|
81
80
|
octokit (~> 4.0)
|
82
|
-
public_suffix (~>
|
81
|
+
public_suffix (~> 3.0)
|
83
82
|
typhoeus (~> 1.3)
|
84
|
-
html-pipeline (2.
|
83
|
+
html-pipeline (2.12.3)
|
85
84
|
activesupport (>= 2)
|
86
85
|
nokogiri (>= 1.4)
|
87
86
|
http_parser.rb (0.6.0)
|
88
87
|
i18n (0.9.5)
|
89
88
|
concurrent-ruby (~> 1.0)
|
90
|
-
jekyll (3.
|
89
|
+
jekyll (3.8.5)
|
91
90
|
addressable (~> 2.4)
|
92
91
|
colorator (~> 1.0)
|
93
92
|
em-websocket (~> 0.5)
|
@@ -100,49 +99,50 @@ GEM
|
|
100
99
|
pathutil (~> 0.9)
|
101
100
|
rouge (>= 1.7, < 4)
|
102
101
|
safe_yaml (~> 1.0)
|
103
|
-
jekyll-avatar (0.
|
104
|
-
jekyll (
|
102
|
+
jekyll-avatar (0.7.0)
|
103
|
+
jekyll (>= 3.0, < 5.0)
|
105
104
|
jekyll-coffeescript (1.1.1)
|
106
105
|
coffee-script (~> 2.2)
|
107
106
|
coffee-script-source (~> 1.11.1)
|
108
|
-
jekyll-commonmark (1.
|
107
|
+
jekyll-commonmark (1.3.1)
|
109
108
|
commonmarker (~> 0.14)
|
110
|
-
jekyll (>= 3.
|
111
|
-
jekyll-commonmark-ghpages (0.1.
|
109
|
+
jekyll (>= 3.7, < 5.0)
|
110
|
+
jekyll-commonmark-ghpages (0.1.6)
|
112
111
|
commonmarker (~> 0.17.6)
|
113
|
-
jekyll-commonmark (~> 1)
|
114
|
-
rouge (
|
112
|
+
jekyll-commonmark (~> 1.2)
|
113
|
+
rouge (>= 2.0, < 4.0)
|
115
114
|
jekyll-default-layout (0.1.4)
|
116
115
|
jekyll (~> 3.0)
|
117
|
-
jekyll-feed (0.
|
118
|
-
jekyll (
|
116
|
+
jekyll-feed (0.13.0)
|
117
|
+
jekyll (>= 3.7, < 5.0)
|
119
118
|
jekyll-gist (1.5.0)
|
120
119
|
octokit (~> 4.2)
|
121
|
-
jekyll-github-metadata (2.
|
122
|
-
jekyll (
|
120
|
+
jekyll-github-metadata (2.13.0)
|
121
|
+
jekyll (>= 3.4, < 5.0)
|
123
122
|
octokit (~> 4.0, != 4.4.0)
|
124
|
-
jekyll-mentions (1.
|
123
|
+
jekyll-mentions (1.5.1)
|
125
124
|
html-pipeline (~> 2.3)
|
126
|
-
jekyll (
|
127
|
-
jekyll-optional-front-matter (0.3.
|
128
|
-
jekyll (
|
125
|
+
jekyll (>= 3.7, < 5.0)
|
126
|
+
jekyll-optional-front-matter (0.3.2)
|
127
|
+
jekyll (>= 3.0, < 5.0)
|
129
128
|
jekyll-paginate (1.1.0)
|
130
|
-
jekyll-readme-index (0.
|
131
|
-
jekyll (
|
132
|
-
jekyll-redirect-from (0.
|
133
|
-
jekyll (
|
134
|
-
jekyll-relative-links (0.
|
135
|
-
jekyll (
|
136
|
-
jekyll-remote-theme (0.
|
137
|
-
|
138
|
-
|
129
|
+
jekyll-readme-index (0.3.0)
|
130
|
+
jekyll (>= 3.0, < 5.0)
|
131
|
+
jekyll-redirect-from (0.15.0)
|
132
|
+
jekyll (>= 3.3, < 5.0)
|
133
|
+
jekyll-relative-links (0.6.1)
|
134
|
+
jekyll (>= 3.3, < 5.0)
|
135
|
+
jekyll-remote-theme (0.4.1)
|
136
|
+
addressable (~> 2.0)
|
137
|
+
jekyll (>= 3.5, < 5.0)
|
138
|
+
rubyzip (>= 1.3.0)
|
139
139
|
jekyll-sass-converter (1.5.2)
|
140
140
|
sass (~> 3.4)
|
141
|
-
jekyll-seo-tag (2.
|
142
|
-
jekyll (
|
143
|
-
jekyll-sitemap (1.
|
144
|
-
jekyll (
|
145
|
-
jekyll-swiss (0.
|
141
|
+
jekyll-seo-tag (2.6.1)
|
142
|
+
jekyll (>= 3.3, < 5.0)
|
143
|
+
jekyll-sitemap (1.4.0)
|
144
|
+
jekyll (>= 3.7, < 5.0)
|
145
|
+
jekyll-swiss (1.0.0)
|
146
146
|
jekyll-theme-architect (0.1.1)
|
147
147
|
jekyll (~> 3.5)
|
148
148
|
jekyll-seo-tag (~> 2.0)
|
@@ -170,8 +170,8 @@ GEM
|
|
170
170
|
jekyll-theme-modernist (0.1.1)
|
171
171
|
jekyll (~> 3.5)
|
172
172
|
jekyll-seo-tag (~> 2.0)
|
173
|
-
jekyll-theme-primer (0.5.
|
174
|
-
jekyll (
|
173
|
+
jekyll-theme-primer (0.5.4)
|
174
|
+
jekyll (> 3.5, < 5.0)
|
175
175
|
jekyll-github-metadata (~> 2.9)
|
176
176
|
jekyll-seo-tag (~> 2.0)
|
177
177
|
jekyll-theme-slate (0.1.1)
|
@@ -183,60 +183,60 @@ GEM
|
|
183
183
|
jekyll-theme-time-machine (0.1.1)
|
184
184
|
jekyll (~> 3.5)
|
185
185
|
jekyll-seo-tag (~> 2.0)
|
186
|
-
jekyll-titles-from-headings (0.5.
|
187
|
-
jekyll (
|
188
|
-
jekyll-watch (2.
|
186
|
+
jekyll-titles-from-headings (0.5.3)
|
187
|
+
jekyll (>= 3.3, < 5.0)
|
188
|
+
jekyll-watch (2.2.1)
|
189
189
|
listen (~> 3.0)
|
190
|
-
jemoji (0.
|
190
|
+
jemoji (0.11.1)
|
191
191
|
gemoji (~> 3.0)
|
192
192
|
html-pipeline (~> 2.2)
|
193
|
-
jekyll (
|
193
|
+
jekyll (>= 3.0, < 5.0)
|
194
194
|
kramdown (1.17.0)
|
195
|
-
liquid (4.0.
|
196
|
-
listen (3.1
|
197
|
-
rb-fsevent (~> 0.
|
198
|
-
rb-inotify (~> 0.9, >= 0.9.
|
199
|
-
ruby_dep (~> 1.2)
|
195
|
+
liquid (4.0.3)
|
196
|
+
listen (3.2.1)
|
197
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
198
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
200
199
|
mercenary (0.3.6)
|
201
200
|
mini_portile2 (2.4.0)
|
202
|
-
minima (2.5.
|
203
|
-
jekyll (
|
201
|
+
minima (2.5.1)
|
202
|
+
jekyll (>= 3.5, < 5.0)
|
204
203
|
jekyll-feed (~> 0.9)
|
205
204
|
jekyll-seo-tag (~> 2.1)
|
206
|
-
minitest (5.
|
207
|
-
multipart-post (2.
|
208
|
-
nokogiri (1.10.
|
205
|
+
minitest (5.14.0)
|
206
|
+
multipart-post (2.1.1)
|
207
|
+
nokogiri (1.10.7)
|
209
208
|
mini_portile2 (~> 2.4.0)
|
210
|
-
octokit (4.
|
209
|
+
octokit (4.15.0)
|
210
|
+
faraday (>= 0.9)
|
211
211
|
sawyer (~> 0.8.0, >= 0.5.3)
|
212
|
-
pathutil (0.16.
|
212
|
+
pathutil (0.16.2)
|
213
213
|
forwardable-extended (~> 2.6)
|
214
|
-
public_suffix (
|
214
|
+
public_suffix (3.1.1)
|
215
215
|
rb-fsevent (0.10.3)
|
216
|
-
rb-inotify (0.
|
217
|
-
ffi (
|
218
|
-
rouge (
|
216
|
+
rb-inotify (0.10.1)
|
217
|
+
ffi (~> 1.0)
|
218
|
+
rouge (3.13.0)
|
219
219
|
ruby-enum (0.7.2)
|
220
220
|
i18n
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
sass (3.6.0)
|
221
|
+
rubyzip (2.0.0)
|
222
|
+
safe_yaml (1.0.5)
|
223
|
+
sass (3.7.4)
|
225
224
|
sass-listen (~> 4.0.0)
|
226
225
|
sass-listen (4.0.0)
|
227
226
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
228
227
|
rb-inotify (~> 0.9, >= 0.9.7)
|
229
|
-
sawyer (0.8.
|
230
|
-
addressable (>= 2.3.5
|
231
|
-
faraday (
|
228
|
+
sawyer (0.8.2)
|
229
|
+
addressable (>= 2.3.5)
|
230
|
+
faraday (> 0.8, < 2.0)
|
232
231
|
terminal-table (1.8.0)
|
233
232
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
234
233
|
thread_safe (0.3.6)
|
235
|
-
typhoeus (1.3.
|
234
|
+
typhoeus (1.3.1)
|
236
235
|
ethon (>= 0.9.0)
|
237
|
-
tzinfo (1.2.
|
236
|
+
tzinfo (1.2.6)
|
238
237
|
thread_safe (~> 0.1)
|
239
|
-
unicode-display_width (1.
|
238
|
+
unicode-display_width (1.6.1)
|
239
|
+
zeitwerk (2.2.2)
|
240
240
|
|
241
241
|
PLATFORMS
|
242
242
|
ruby
|
@@ -245,4 +245,4 @@ DEPENDENCIES
|
|
245
245
|
github-pages
|
246
246
|
|
247
247
|
BUNDLED WITH
|
248
|
-
|
248
|
+
2.0.2
|
data/lib/active_admin.rb
CHANGED
@@ -73,7 +73,7 @@ module ActiveAdmin
|
|
73
73
|
def namespace(name)
|
74
74
|
name ||= :root
|
75
75
|
|
76
|
-
namespace = namespaces[name] ||= begin
|
76
|
+
namespace = namespaces[name.to_sym] ||= begin
|
77
77
|
namespace = Namespace.new(self, name)
|
78
78
|
ActiveSupport::Notifications.publish ActiveAdmin::Namespace::RegisterEvent, namespace
|
79
79
|
namespace
|
@@ -51,14 +51,14 @@ module ActiveAdmin
|
|
51
51
|
csv << bom if bom
|
52
52
|
|
53
53
|
if column_names
|
54
|
-
csv << CSV.generate_line(columns.map { |c| encode c.name, options }, csv_options)
|
54
|
+
csv << CSV.generate_line(columns.map { |c| encode c.name, options }, **csv_options)
|
55
55
|
end
|
56
56
|
|
57
57
|
ActiveRecord::Base.uncached do
|
58
58
|
(1..paginated_collection.total_pages).each do |page|
|
59
59
|
paginated_collection(page).each do |resource|
|
60
60
|
resource = controller.send :apply_decorator, resource
|
61
|
-
csv << CSV.generate_line(build_row(resource, columns, options), csv_options)
|
61
|
+
csv << CSV.generate_line(build_row(resource, columns, options), **csv_options)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -81,7 +81,11 @@ module ActiveAdmin
|
|
81
81
|
|
82
82
|
def encode(content, options)
|
83
83
|
if options[:encoding]
|
84
|
-
|
84
|
+
if options[:encoding_options]
|
85
|
+
content.to_s.encode options[:encoding], **options[:encoding_options]
|
86
|
+
else
|
87
|
+
content.to_s.encode options[:encoding]
|
88
|
+
end
|
85
89
|
else
|
86
90
|
content
|
87
91
|
end
|
@@ -129,12 +129,36 @@ module ActiveAdmin
|
|
129
129
|
not_poly.reject! { |r| r.chain.length > 2 }
|
130
130
|
|
131
131
|
filters = poly.map(&:foreign_type) + not_poly.map(&:name)
|
132
|
+
|
133
|
+
# Check high-arity associations for filterable columns
|
134
|
+
max = namespace.maximum_association_filter_arity
|
135
|
+
if max != :unlimited
|
136
|
+
high_arity, low_arity = not_poly.partition do |r|
|
137
|
+
r.klass.reorder(nil).limit(max + 1).count > max
|
138
|
+
end
|
139
|
+
|
140
|
+
# Remove high-arity associations with no searchable column
|
141
|
+
high_arity = high_arity.select(&method(:searchable_column_for))
|
142
|
+
|
143
|
+
high_arity = high_arity.map { |r| r.name.to_s + "_" + searchable_column_for(r) + namespace.filter_method_for_large_association }
|
144
|
+
|
145
|
+
filters = poly.map(&:foreign_type) + low_arity.map(&:name) + high_arity
|
146
|
+
end
|
147
|
+
|
132
148
|
filters.map &:to_sym
|
133
149
|
else
|
134
150
|
[]
|
135
151
|
end
|
136
152
|
end
|
137
153
|
|
154
|
+
def search_columns
|
155
|
+
@search_columns ||= namespace.filter_columns_for_large_association.map(&:to_s)
|
156
|
+
end
|
157
|
+
|
158
|
+
def searchable_column_for(relation)
|
159
|
+
relation.klass.column_names.find { |name| search_columns.include?(name) }
|
160
|
+
end
|
161
|
+
|
138
162
|
def add_filters_sidebar_section
|
139
163
|
self.sidebar_sections << filters_sidebar_section
|
140
164
|
end
|
@@ -7,8 +7,8 @@ module ActiveAdmin
|
|
7
7
|
def to_html
|
8
8
|
input_wrapping do
|
9
9
|
[ label_html,
|
10
|
-
builder.text_field(gt_input_name,
|
11
|
-
builder.text_field(lt_input_name,
|
10
|
+
builder.text_field(gt_input_name, input_html_options_for(gt_input_name, gt_input_placeholder)),
|
11
|
+
builder.text_field(lt_input_name, input_html_options_for(lt_input_name, lt_input_placeholder)),
|
12
12
|
].join("\n").html_safe
|
13
13
|
end
|
14
14
|
end
|
@@ -22,18 +22,21 @@ module ActiveAdmin
|
|
22
22
|
column && column.type == :date ? "#{method}_lteq" : "#{method}_lteq_datetime"
|
23
23
|
end
|
24
24
|
|
25
|
-
def input_html_options
|
26
|
-
current_value = begin
|
27
|
-
#cast value to date object before rendering input
|
28
|
-
@object.public_send(input_name).to_s.to_date
|
29
|
-
rescue
|
30
|
-
nil
|
31
|
-
end
|
25
|
+
def input_html_options
|
32
26
|
{ size: 12,
|
33
27
|
class: "datepicker",
|
34
|
-
maxlength: 10
|
35
|
-
|
36
|
-
|
28
|
+
maxlength: 10 }.merge(options[:input_html] || {})
|
29
|
+
end
|
30
|
+
|
31
|
+
def input_html_options_for(input_name, placeholder)
|
32
|
+
current_value = begin
|
33
|
+
#cast value to date object before rendering input
|
34
|
+
@object.public_send(input_name).to_s.to_date
|
35
|
+
rescue
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
{ placeholder: placeholder,
|
39
|
+
value: current_value ? current_value.strftime("%Y-%m-%d") : "" }.merge(input_html_options)
|
37
40
|
end
|
38
41
|
|
39
42
|
def gt_input_placeholder
|