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.

Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +106 -35
  3. data/CONTRIBUTING.md +50 -54
  4. data/README.md +1 -1
  5. data/app/assets/javascripts/active_admin/base.js +519 -0
  6. data/app/assets/stylesheets/active_admin/_base.scss +29 -29
  7. data/app/assets/stylesheets/active_admin/_header.scss +3 -5
  8. data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
  9. data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +0 -0
  10. data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
  11. data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
  12. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +5 -0
  13. data/app/assets/stylesheets/active_admin/print.scss +2 -2
  14. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
  15. data/app/javascript/active_admin/base.js +28 -0
  16. data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
  17. data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
  18. data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +4 -2
  19. data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
  20. data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
  21. data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
  22. data/app/javascript/active_admin/initializers/filters.js +10 -0
  23. data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +0 -0
  24. data/app/javascript/active_admin/initializers/per-page.js +13 -0
  25. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
  26. data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
  27. data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +2 -2
  28. data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +2 -9
  29. data/app/javascript/active_admin/lib/filters.js +39 -0
  30. data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +3 -1
  31. data/app/javascript/active_admin/lib/per-page.js +38 -0
  32. data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +4 -2
  33. data/app/javascript/active_admin/lib/utils.js +40 -0
  34. data/config/locales/az.yml +138 -0
  35. data/config/locales/de.yml +18 -0
  36. data/config/locales/en-CA.yml +3 -3
  37. data/config/locales/en-GB.yml +3 -3
  38. data/config/locales/en.yml +3 -3
  39. data/config/locales/es.yml +3 -3
  40. data/config/locales/fr.yml +4 -4
  41. data/config/locales/lv.yml +2 -2
  42. data/config/locales/sk.yml +59 -0
  43. data/config/locales/vi.yml +1 -0
  44. data/docs/1-general-configuration.md +20 -0
  45. data/docs/3-index-pages.md +1 -1
  46. data/docs/9-batch-actions.md +2 -2
  47. data/docs/Gemfile.lock +103 -103
  48. data/lib/active_admin.rb +0 -1
  49. data/lib/active_admin/application.rb +1 -1
  50. data/lib/active_admin/csv_builder.rb +7 -3
  51. data/lib/active_admin/filters/active_filter.rb +1 -1
  52. data/lib/active_admin/filters/resource_extension.rb +24 -0
  53. data/lib/active_admin/inputs/filters/date_range_input.rb +15 -12
  54. data/lib/active_admin/localizers/resource_localizer.rb +1 -1
  55. data/lib/active_admin/namespace_settings.rb +13 -0
  56. data/lib/active_admin/order_clause.rb +1 -1
  57. data/lib/active_admin/resource.rb +1 -1
  58. data/lib/active_admin/resource/naming.rb +1 -1
  59. data/lib/active_admin/resource_controller/decorators.rb +2 -2
  60. data/lib/active_admin/resource_controller/polymorphic_routes.rb +3 -2
  61. data/lib/active_admin/version.rb +1 -1
  62. data/lib/active_admin/views/components/paginated_collection.rb +2 -1
  63. data/lib/active_admin/views/components/table_for.rb +1 -0
  64. data/lib/active_admin/views/pages/base.rb +5 -3
  65. data/lib/active_admin/views/pages/index.rb +1 -0
  66. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +14 -1
  67. metadata +35 -45
  68. data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
  69. data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
  70. data/app/assets/images/active_admin/orderable.png +0 -0
  71. data/app/assets/javascripts/active_admin/base.es6 +0 -23
  72. data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
  73. data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
  74. data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
@@ -212,7 +212,7 @@ end
212
212
  ```
213
213
 
214
214
  Scopes can be labelled with a translation, e.g.
215
- `activerecord.scopes.invoice.expired`.
215
+ `active_admin.scopes.scope_method`.
216
216
 
217
217
  ### Scopes groups
218
218
 
@@ -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.modal_dialog` which you
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.modal_dialog $(@).data('prompt'), comment: 'textarea',
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'),
@@ -1,13 +1,14 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (4.2.10)
5
- i18n (~> 0.7)
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
- addressable (2.5.2)
10
- public_suffix (>= 2.0.2, < 4.0)
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.0.5)
19
- dnsruby (1.61.2)
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.11.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.15.3)
29
+ faraday (1.0.0)
29
30
  multipart-post (>= 1.2, < 3)
30
- ffi (1.9.25)
31
+ ffi (1.12.1)
31
32
  forwardable-extended (2.6.0)
32
- gemoji (3.0.0)
33
- github-pages (192)
34
- activesupport (= 4.2.10)
35
- github-pages-health-check (= 1.8.1)
36
- jekyll (= 3.7.4)
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.5)
39
+ jekyll-commonmark-ghpages (= 0.1.6)
40
40
  jekyll-default-layout (= 0.1.4)
41
- jekyll-feed (= 0.10.0)
41
+ jekyll-feed (= 0.13.0)
42
42
  jekyll-gist (= 1.5.0)
43
- jekyll-github-metadata (= 2.9.4)
44
- jekyll-mentions (= 1.4.1)
45
- jekyll-optional-front-matter (= 0.3.0)
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.2.0)
48
- jekyll-redirect-from (= 0.14.0)
49
- jekyll-relative-links (= 0.5.3)
50
- jekyll-remote-theme (= 0.3.1)
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.5.0)
53
- jekyll-sitemap (= 1.2.0)
54
- jekyll-swiss (= 0.4.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.3)
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.1)
69
- jemoji (= 0.10.1)
68
+ jekyll-titles-from-headings (= 0.5.3)
69
+ jemoji (= 0.11.1)
70
70
  kramdown (= 1.17.0)
71
- liquid (= 4.0.0)
72
- listen (= 3.1.5)
71
+ liquid (= 4.0.3)
73
72
  mercenary (~> 0.3)
74
- minima (= 2.5.0)
75
- nokogiri (>= 1.8.2, < 2.0)
76
- rouge (= 2.2.1)
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.8.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 (~> 2.0)
81
+ public_suffix (~> 3.0)
83
82
  typhoeus (~> 1.3)
84
- html-pipeline (2.8.4)
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.7.4)
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.6.0)
104
- jekyll (~> 3.0)
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.2.0)
107
+ jekyll-commonmark (1.3.1)
109
108
  commonmarker (~> 0.14)
110
- jekyll (>= 3.0, < 4.0)
111
- jekyll-commonmark-ghpages (0.1.5)
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 (~> 2)
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.10.0)
118
- jekyll (~> 3.3)
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.9.4)
122
- jekyll (~> 3.1)
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.4.1)
123
+ jekyll-mentions (1.5.1)
125
124
  html-pipeline (~> 2.3)
126
- jekyll (~> 3.0)
127
- jekyll-optional-front-matter (0.3.0)
128
- jekyll (~> 3.0)
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.2.0)
131
- jekyll (~> 3.0)
132
- jekyll-redirect-from (0.14.0)
133
- jekyll (~> 3.3)
134
- jekyll-relative-links (0.5.3)
135
- jekyll (~> 3.3)
136
- jekyll-remote-theme (0.3.1)
137
- jekyll (~> 3.5)
138
- rubyzip (>= 1.2.1, < 3.0)
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.5.0)
142
- jekyll (~> 3.3)
143
- jekyll-sitemap (1.2.0)
144
- jekyll (~> 3.3)
145
- jekyll-swiss (0.4.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.3)
174
- jekyll (~> 3.5)
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.1)
187
- jekyll (~> 3.3)
188
- jekyll-watch (2.0.0)
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.10.1)
190
+ jemoji (0.11.1)
191
191
  gemoji (~> 3.0)
192
192
  html-pipeline (~> 2.2)
193
- jekyll (~> 3.0)
193
+ jekyll (>= 3.0, < 5.0)
194
194
  kramdown (1.17.0)
195
- liquid (4.0.0)
196
- listen (3.1.5)
197
- rb-fsevent (~> 0.9, >= 0.9.4)
198
- rb-inotify (~> 0.9, >= 0.9.7)
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.0)
203
- jekyll (~> 3.5)
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.11.3)
207
- multipart-post (2.0.0)
208
- nokogiri (1.10.4)
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.12.0)
209
+ octokit (4.15.0)
210
+ faraday (>= 0.9)
211
211
  sawyer (~> 0.8.0, >= 0.5.3)
212
- pathutil (0.16.1)
212
+ pathutil (0.16.2)
213
213
  forwardable-extended (~> 2.6)
214
- public_suffix (2.0.5)
214
+ public_suffix (3.1.1)
215
215
  rb-fsevent (0.10.3)
216
- rb-inotify (0.9.10)
217
- ffi (>= 0.5.0, < 2)
218
- rouge (2.2.1)
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
- ruby_dep (1.5.0)
222
- rubyzip (1.2.2)
223
- safe_yaml (1.0.4)
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.1)
230
- addressable (>= 2.3.5, < 2.6)
231
- faraday (~> 0.8, < 1.0)
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.0)
234
+ typhoeus (1.3.1)
236
235
  ethon (>= 0.9.0)
237
- tzinfo (1.2.5)
236
+ tzinfo (1.2.6)
238
237
  thread_safe (~> 0.1)
239
- unicode-display_width (1.4.0)
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
- 1.16.5
248
+ 2.0.2
@@ -10,7 +10,6 @@ require 'inherited_resources'
10
10
  require 'jquery-rails'
11
11
  require 'sassc-rails'
12
12
  require 'arbre'
13
- require 'sprockets/es6'
14
13
 
15
14
  require 'active_admin/helpers/i18n'
16
15
 
@@ -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
- content.to_s.encode options[:encoding], options[:encoding_options]
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
@@ -96,7 +96,7 @@ module ActiveAdmin
96
96
  end
97
97
 
98
98
  def filter
99
- resource.filters[name.to_sym]
99
+ resource.filters[name.to_sym] || resource.filters[condition.key.to_sym]
100
100
  end
101
101
 
102
102
  def related_primary_key
@@ -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, input_html_options(gt_input_name, gt_input_placeholder)),
11
- builder.text_field(lt_input_name, input_html_options(lt_input_name, lt_input_placeholder)),
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(input_name = gt_input_name, placeholder = gt_input_placeholder)
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
- placeholder: placeholder,
36
- value: current_value ? current_value.strftime("%Y-%m-%d") : "" }
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