activeadmin 2.3.1 → 2.7.0
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 +120 -35
- data/CONTRIBUTING.md +51 -55
- data/README.md +2 -2
- 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 +40 -8
- 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 +8 -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/app/views/layouts/active_admin_logged_out.html.erb +15 -5
- 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 +6 -5
- data/docs/0-installation.md +26 -2
- data/docs/1-general-configuration.md +20 -0
- data/docs/2-resource-customization.md +10 -1
- data/docs/3-index-pages.md +1 -1
- data/docs/9-batch-actions.md +2 -2
- data/docs/Gemfile.lock +103 -103
- data/docs/_includes/top-menu.html +1 -1
- data/docs/documentation.md +1 -1
- data/docs/index.html +6 -6
- 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/menu.rb +5 -2
- data/lib/active_admin/namespace_settings.rb +16 -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/scopes.rb +2 -0
- data/lib/active_admin/views/components/table_for.rb +2 -1
- data/lib/active_admin/views/pages/base.rb +9 -5
- data/lib/active_admin/views/pages/index.rb +1 -0
- data/lib/generators/active_admin/install/install_generator.rb +7 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +21 -1
- data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
- data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +26 -0
- metadata +32 -43
- 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
@@ -8,7 +8,7 @@
|
|
8
8
|
</div>
|
9
9
|
|
10
10
|
<div id="tidelift">
|
11
|
-
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=
|
11
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
|
12
12
|
<span class="cta">
|
13
13
|
Active Admin for enterprise available via Tidelift
|
14
14
|
</span>
|
data/docs/documentation.md
CHANGED
data/docs/index.html
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
</h3>
|
51
51
|
|
52
52
|
<p>
|
53
|
-
Each resource that is registered
|
53
|
+
Each resource that is registered with Active Admin becomes available as <span class="caps">JSON</span>, <span class="caps">XML</span> and <span class="caps">CSV</span> download. Customize the output to meet your requirements.
|
54
54
|
</p>
|
55
55
|
</div>
|
56
56
|
|
@@ -133,7 +133,7 @@
|
|
133
133
|
</h2>
|
134
134
|
|
135
135
|
<p>
|
136
|
-
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=
|
136
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise">
|
137
137
|
Available as part of the Tidelift Subscription
|
138
138
|
</a>
|
139
139
|
</p>
|
@@ -150,11 +150,11 @@
|
|
150
150
|
</p>
|
151
151
|
|
152
152
|
<div class="tidelift-buttons">
|
153
|
-
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
153
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
|
154
154
|
<span>LEARN MORE</span>
|
155
155
|
</a>
|
156
156
|
|
157
|
-
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
157
|
+
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
|
158
158
|
<span>REQUEST A DEMO</span>
|
159
159
|
</a>
|
160
160
|
</div>
|
@@ -202,11 +202,11 @@
|
|
202
202
|
</p>
|
203
203
|
|
204
204
|
<div class="tidelift-buttons">
|
205
|
-
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
205
|
+
<a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
|
206
206
|
<span>LEARN MORE</span>
|
207
207
|
</a>
|
208
208
|
|
209
|
-
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
|
209
|
+
<a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
|
210
210
|
<span>REQUEST A DEMO</span>
|
211
211
|
</a>
|
212
212
|
</div>
|
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
|
@@ -21,7 +21,7 @@ module ActiveAdmin
|
|
21
21
|
scope = options.delete(:scope)
|
22
22
|
specific_key = array_to_key('resources', @model_name, scope, key)
|
23
23
|
defaults = [array_to_key(scope, key), key.to_s.titleize]
|
24
|
-
::I18n.t specific_key, options.reverse_merge(model: @model, default: defaults, scope: 'active_admin')
|
24
|
+
::I18n.t specific_key, **options.reverse_merge(model: @model, default: defaults, scope: 'active_admin')
|
25
25
|
end
|
26
26
|
alias_method :t, :translate
|
27
27
|
|
data/lib/active_admin/menu.rb
CHANGED
@@ -47,7 +47,10 @@ module ActiveAdmin
|
|
47
47
|
# menu.add parent: 'Dashboard', label: 'My Child Dashboard'
|
48
48
|
#
|
49
49
|
def add(options)
|
50
|
-
|
50
|
+
parent_chain = Array.wrap(options.delete(:parent))
|
51
|
+
|
52
|
+
item = if parent = parent_chain.shift
|
53
|
+
options[:parent] = parent_chain if parent_chain.any?
|
51
54
|
(self[parent] || add(label: parent)).add options
|
52
55
|
else
|
53
56
|
_add options.merge parent: self
|
@@ -60,7 +63,7 @@ module ActiveAdmin
|
|
60
63
|
|
61
64
|
# Whether any children match the given item.
|
62
65
|
def include?(item)
|
63
|
-
@children.values.include? item
|
66
|
+
@children.values.include?(item) || @children.values.any? { |child| child.include?(item) }
|
64
67
|
end
|
65
68
|
|
66
69
|
# Used in the UI to visually distinguish which menu item is selected.
|
@@ -106,5 +106,21 @@ module ActiveAdmin
|
|
106
106
|
|
107
107
|
# Include association filters by default
|
108
108
|
register :include_default_association_filters, true
|
109
|
+
|
110
|
+
register :maximum_association_filter_arity, :unlimited
|
111
|
+
|
112
|
+
register :filter_columns_for_large_association, [
|
113
|
+
:display_name,
|
114
|
+
:full_name,
|
115
|
+
:name,
|
116
|
+
:username,
|
117
|
+
:login,
|
118
|
+
:title,
|
119
|
+
:email,
|
120
|
+
]
|
121
|
+
register :filter_method_for_large_association, '_starts_with'
|
122
|
+
|
123
|
+
# Switch between asset pipeline and webpacker assets
|
124
|
+
register :use_webpacker, false
|
109
125
|
end
|
110
126
|
end
|
@@ -70,7 +70,7 @@ module ActiveAdmin
|
|
70
70
|
def initialize(namespace, resource_class, options = {})
|
71
71
|
@namespace = namespace
|
72
72
|
@resource_class_name = "::#{resource_class.name}"
|
73
|
-
@options
|
73
|
+
@options = options
|
74
74
|
@sort_order = options[:sort_order]
|
75
75
|
@member_actions = []
|
76
76
|
@collection_actions = []
|
@@ -67,8 +67,8 @@ module ActiveAdmin
|
|
67
67
|
def self.wrap!(parent, name)
|
68
68
|
::Class.new parent do
|
69
69
|
delegate :reorder, :page, :current_page, :total_pages, :limit_value,
|
70
|
-
:total_count, :total_pages, :
|
71
|
-
:find_each, :ransack
|
70
|
+
:total_count, :total_pages, :offset, :to_key, :group_values,
|
71
|
+
:except, :find_each, :ransack
|
72
72
|
|
73
73
|
define_singleton_method(:name) { name }
|
74
74
|
end
|
@@ -25,8 +25,9 @@ module ActiveAdmin
|
|
25
25
|
return ActiveAdmin::Model.new(active_admin_config, record)
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
belongs_to_resource = active_admin_config.belongs_to_config.try(:resource)
|
29
|
+
if belongs_to_resource && record.is_a?(belongs_to_resource.resource_class)
|
30
|
+
return ActiveAdmin::Model.new(belongs_to_resource, record)
|
30
31
|
end
|
31
32
|
|
32
33
|
record
|
data/lib/active_admin/version.rb
CHANGED
@@ -96,7 +96,7 @@ module ActiveAdmin
|
|
96
96
|
options[:params] = @params if @params
|
97
97
|
options[:param_name] = @param_name if @param_name
|
98
98
|
|
99
|
-
if !@display_total
|
99
|
+
if !@display_total
|
100
100
|
# The #paginate method in kaminari will query the resource with a
|
101
101
|
# count(*) to determine how many pages there should be unless
|
102
102
|
# you pass in the :total_pages option. We issue a query to determine
|
@@ -123,6 +123,7 @@ module ActiveAdmin
|
|
123
123
|
entries_name = I18n.t "active_admin.pagination.entry", count: 2, default: 'entries'
|
124
124
|
else
|
125
125
|
key = "activerecord.models." + collection.first.class.model_name.i18n_key.to_s
|
126
|
+
|
126
127
|
entry_name = I18n.translate key, count: 1, default: collection.first.class.name.underscore.sub('_', ' ')
|
127
128
|
entries_name = I18n.translate key, count: collection.size, default: entry_name.pluralize
|
128
129
|
end
|
@@ -13,6 +13,7 @@ module ActiveAdmin
|
|
13
13
|
@collection = obj.respond_to?(:each) && !obj.is_a?(Hash) ? obj : [obj]
|
14
14
|
@resource_class = options.delete(:i18n)
|
15
15
|
@resource_class ||= @collection.klass if @collection.respond_to? :klass
|
16
|
+
|
16
17
|
@columns = []
|
17
18
|
@row_class = options.delete(:row_class)
|
18
19
|
|
@@ -137,7 +138,7 @@ module ActiveAdmin
|
|
137
138
|
|
138
139
|
class Column
|
139
140
|
|
140
|
-
attr_accessor :title, :data
|
141
|
+
attr_accessor :title, :data, :html_class
|
141
142
|
|
142
143
|
def initialize(*args, &block)
|
143
144
|
@options = args.extract_options!
|
@@ -29,15 +29,17 @@ module ActiveAdmin
|
|
29
29
|
text_node(active_admin_namespace.head)
|
30
30
|
|
31
31
|
active_admin_application.stylesheets.each do |style, options|
|
32
|
-
|
32
|
+
stylesheet_tag = active_admin_namespace.use_webpacker ? stylesheet_pack_tag(style, options) : stylesheet_link_tag(style, options)
|
33
|
+
text_node(stylesheet_tag.html_safe) if stylesheet_tag
|
33
34
|
end
|
34
35
|
|
35
36
|
active_admin_namespace.meta_tags.each do |name, content|
|
36
|
-
text_node(
|
37
|
+
text_node(meta(name: name, content: content))
|
37
38
|
end
|
38
39
|
|
39
40
|
active_admin_application.javascripts.each do |path|
|
40
|
-
|
41
|
+
javascript_tag = active_admin_namespace.use_webpacker ? javascript_pack_tag(path) : javascript_include_tag(path)
|
42
|
+
text_node(javascript_tag)
|
41
43
|
end
|
42
44
|
|
43
45
|
if active_admin_namespace.favicon
|
@@ -85,8 +87,10 @@ module ActiveAdmin
|
|
85
87
|
|
86
88
|
def build_flash_messages
|
87
89
|
div class: 'flashes' do
|
88
|
-
flash_messages.each do |type,
|
89
|
-
|
90
|
+
flash_messages.each do |type, messages|
|
91
|
+
[*messages].each do |message|
|
92
|
+
div message, class: "flash flash_#{type}"
|
93
|
+
end
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
@@ -124,6 +124,7 @@ module ActiveAdmin
|
|
124
124
|
|
125
125
|
def render_index
|
126
126
|
renderer_class = find_index_renderer_class(config[:as])
|
127
|
+
|
127
128
|
paginator = config.fetch(:paginator, true)
|
128
129
|
download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
|
129
130
|
pagination_total = config.fetch(:pagination_total, true)
|
@@ -8,6 +8,7 @@ module ActiveAdmin
|
|
8
8
|
|
9
9
|
hook_for :users, default: "devise", desc: "Admin user generator to run. Skip with --skip-users"
|
10
10
|
class_option :skip_comments, type: :boolean, default: false, desc: "Skip installation of comments"
|
11
|
+
class_option :use_webpacker, type: :boolean, default: false, desc: "Use Webpacker assets instead of Sprockets"
|
11
12
|
|
12
13
|
source_root File.expand_path('templates', __dir__)
|
13
14
|
|
@@ -15,6 +16,7 @@ module ActiveAdmin
|
|
15
16
|
@underscored_user_name = name.underscore.gsub('/', '_')
|
16
17
|
@use_authentication_method = options[:users].present?
|
17
18
|
@skip_comments = options[:skip_comments]
|
19
|
+
@use_webpacker = options[:use_webpacker]
|
18
20
|
template 'active_admin.rb.erb', 'config/initializers/active_admin.rb'
|
19
21
|
end
|
20
22
|
|
@@ -36,7 +38,11 @@ module ActiveAdmin
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def create_assets
|
39
|
-
|
41
|
+
if options[:use_webpacker]
|
42
|
+
generate "active_admin:webpacker"
|
43
|
+
else
|
44
|
+
generate "active_admin:assets"
|
45
|
+
end
|
40
46
|
end
|
41
47
|
|
42
48
|
def create_migrations
|
@@ -286,12 +286,25 @@ ActiveAdmin.setup do |config|
|
|
286
286
|
# config.filters = true
|
287
287
|
#
|
288
288
|
# By default the filters include associations in a select, which means
|
289
|
-
# that every record will be loaded for each association
|
289
|
+
# that every record will be loaded for each association (up
|
290
|
+
# to the value of config.maximum_association_filter_arity).
|
290
291
|
# You can enabled or disable the inclusion
|
291
292
|
# of those filters by default here.
|
292
293
|
#
|
293
294
|
# config.include_default_association_filters = true
|
294
295
|
|
296
|
+
# config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
|
297
|
+
# config.filter_columns_for_large_association, [
|
298
|
+
# :display_name,
|
299
|
+
# :full_name,
|
300
|
+
# :name,
|
301
|
+
# :username,
|
302
|
+
# :login,
|
303
|
+
# :title,
|
304
|
+
# :email,
|
305
|
+
# ]
|
306
|
+
# config.filter_method_for_large_association, '_starts_with'
|
307
|
+
|
295
308
|
# == Head
|
296
309
|
#
|
297
310
|
# You can add your own content to the site head like analytics. Make sure
|
@@ -312,4 +325,11 @@ ActiveAdmin.setup do |config|
|
|
312
325
|
# You can inherit it with own class and inject it for all resources
|
313
326
|
#
|
314
327
|
# config.order_clause = MyOrderClause
|
328
|
+
|
329
|
+
# == Webpacker
|
330
|
+
#
|
331
|
+
# By default, Active Admin uses Sprocket's asset pipeline.
|
332
|
+
# You can switch to using Webpacker here.
|
333
|
+
#
|
334
|
+
<% unless @use_webpacker %># <% end %>config.use_webpacker = true
|
315
335
|
end
|