activeadmin 2.5.0 → 2.8.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 +120 -6
- data/CONTRIBUTING.md +11 -57
- data/README.md +2 -2
- data/app/assets/javascripts/active_admin/base.js +26 -18
- data/app/assets/stylesheets/active_admin/_header.scss +37 -3
- data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +3 -0
- data/app/javascript/active_admin/base.js +9 -0
- data/app/javascript/active_admin/initializers/per-page.js +1 -1
- data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
- data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
- data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
- data/app/javascript/active_admin/lib/per-page.js +1 -1
- data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
- data/app/views/layouts/active_admin_logged_out.html.erb +15 -5
- data/config/locales/ar.yml +6 -6
- 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-MX.yml +2 -1
- data/config/locales/es.yml +5 -5
- data/config/locales/fr.yml +4 -4
- data/config/locales/it.yml +18 -0
- data/config/locales/ja.yml +3 -3
- data/config/locales/lv.yml +2 -2
- data/config/locales/vi.yml +6 -5
- data/docs/0-installation.md +26 -2
- data/docs/11-decorators.md +16 -5
- 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 +2 -2
- data/docs/Gemfile.lock +93 -84
- 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 +60 -60
- data/lib/active_admin/application.rb +13 -13
- data/lib/active_admin/application_settings.rb +3 -3
- data/lib/active_admin/authorization_adapter.rb +3 -3
- data/lib/active_admin/base_controller.rb +4 -4
- data/lib/active_admin/base_controller/authorization.rb +13 -12
- data/lib/active_admin/batch_actions/controller.rb +3 -3
- data/lib/active_admin/batch_actions/resource_extension.rb +9 -8
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +3 -3
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +6 -6
- data/lib/active_admin/batch_actions/views/selection_cells.rb +3 -3
- data/lib/active_admin/cancan_adapter.rb +1 -1
- data/lib/active_admin/collection_decorator.rb +31 -0
- data/lib/active_admin/csv_builder.rb +11 -7
- data/lib/active_admin/dependency.rb +11 -11
- data/lib/active_admin/devise.rb +5 -5
- data/lib/active_admin/dsl.rb +1 -1
- data/lib/active_admin/dynamic_settings_node.rb +2 -2
- data/lib/active_admin/engine.rb +3 -3
- data/lib/active_admin/filters.rb +7 -7
- data/lib/active_admin/filters/active.rb +1 -1
- data/lib/active_admin/filters/active_filter.rb +5 -4
- data/lib/active_admin/filters/active_sidebar.rb +5 -5
- data/lib/active_admin/filters/forms.rb +6 -6
- data/lib/active_admin/filters/formtastic_addons.rb +1 -6
- data/lib/active_admin/filters/resource_extension.rb +1 -1
- data/lib/active_admin/form_builder.rb +21 -19
- data/lib/active_admin/generators/boilerplate.rb +1 -1
- data/lib/active_admin/helpers/optional_display.rb +2 -2
- data/lib/active_admin/inputs/datepicker_input.rb +1 -1
- data/lib/active_admin/inputs/filters/base.rb +1 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +4 -4
- data/lib/active_admin/inputs/filters/boolean_input.rb +1 -1
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -1
- data/lib/active_admin/inputs/filters/date_range_input.rb +12 -9
- data/lib/active_admin/inputs/filters/select_input.rb +2 -2
- data/lib/active_admin/localizers.rb +1 -1
- data/lib/active_admin/localizers/resource_localizer.rb +3 -3
- data/lib/active_admin/menu.rb +6 -3
- data/lib/active_admin/menu_item.rb +7 -7
- data/lib/active_admin/namespace.rb +12 -12
- data/lib/active_admin/namespace_settings.rb +8 -5
- data/lib/active_admin/order_clause.rb +1 -1
- data/lib/active_admin/orm/active_record.rb +1 -1
- data/lib/active_admin/orm/active_record/comments.rb +19 -19
- data/lib/active_admin/orm/active_record/comments/comment.rb +3 -3
- data/lib/active_admin/orm/active_record/comments/views.rb +2 -2
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +19 -19
- data/lib/active_admin/page.rb +1 -1
- data/lib/active_admin/pundit_adapter.rb +5 -5
- data/lib/active_admin/resource.rb +17 -17
- data/lib/active_admin/resource/action_items.rb +5 -5
- data/lib/active_admin/resource/attributes.rb +1 -1
- data/lib/active_admin/resource/belongs_to.rb +2 -2
- data/lib/active_admin/resource/controllers.rb +1 -1
- data/lib/active_admin/resource/menu.rb +4 -4
- data/lib/active_admin/resource/naming.rb +5 -5
- data/lib/active_admin/resource/routes.rb +5 -5
- data/lib/active_admin/resource/scope_to.rb +7 -7
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource_controller.rb +12 -11
- data/lib/active_admin/resource_controller/data_access.rb +1 -1
- data/lib/active_admin/resource_controller/decorators.rb +6 -26
- data/lib/active_admin/resource_controller/streaming.rb +7 -6
- data/lib/active_admin/resource_dsl.rb +5 -5
- data/lib/active_admin/scope.rb +6 -6
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +17 -17
- data/lib/active_admin/view_helpers.rb +1 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +3 -3
- data/lib/active_admin/view_helpers/display_helper.rb +5 -5
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -1
- data/lib/active_admin/view_helpers/fields_for.rb +2 -2
- data/lib/active_admin/views.rb +1 -1
- data/lib/active_admin/views/components/active_admin_form.rb +5 -5
- data/lib/active_admin/views/components/attributes_table.rb +5 -5
- data/lib/active_admin/views/components/blank_slate.rb +1 -1
- data/lib/active_admin/views/components/dropdown_menu.rb +8 -8
- data/lib/active_admin/views/components/index_list.rb +3 -3
- data/lib/active_admin/views/components/menu.rb +1 -1
- data/lib/active_admin/views/components/menu_item.rb +4 -4
- data/lib/active_admin/views/components/paginated_collection.rb +18 -18
- data/lib/active_admin/views/components/panel.rb +1 -1
- data/lib/active_admin/views/components/scopes.rb +7 -5
- data/lib/active_admin/views/components/site_title.rb +1 -1
- data/lib/active_admin/views/components/status_tag.rb +11 -11
- data/lib/active_admin/views/components/table_for.rb +17 -17
- data/lib/active_admin/views/components/tabs.rb +3 -3
- data/lib/active_admin/views/footer.rb +2 -1
- data/lib/active_admin/views/header.rb +2 -2
- data/lib/active_admin/views/index_as_blog.rb +1 -1
- data/lib/active_admin/views/index_as_grid.rb +1 -1
- data/lib/active_admin/views/index_as_table.rb +16 -16
- data/lib/active_admin/views/pages/base.rb +14 -10
- data/lib/active_admin/views/pages/index.rb +14 -13
- data/lib/active_admin/views/tabbed_navigation.rb +2 -2
- data/lib/active_admin/views/title_bar.rb +1 -1
- data/lib/activeadmin.rb +1 -1
- data/lib/generators/active_admin/assets/assets_generator.rb +2 -2
- data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
- data/lib/generators/active_admin/devise/devise_generator.rb +5 -5
- data/lib/generators/active_admin/install/install_generator.rb +14 -8
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +9 -2
- data/lib/generators/active_admin/page/page_generator.rb +1 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +3 -3
- 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
- data/lib/ransack_ext.rb +8 -8
- metadata +20 -8
@@ -5,11 +5,11 @@ module ActiveAdmin
|
|
5
5
|
builder_method :status_tag
|
6
6
|
|
7
7
|
def tag_name
|
8
|
-
|
8
|
+
"span"
|
9
9
|
end
|
10
10
|
|
11
11
|
def default_class_name
|
12
|
-
|
12
|
+
"status_tag"
|
13
13
|
end
|
14
14
|
|
15
15
|
# @overload status_tag(status, options = {})
|
@@ -49,12 +49,12 @@ module ActiveAdmin
|
|
49
49
|
|
50
50
|
def convert_to_boolean_status(status)
|
51
51
|
case status
|
52
|
-
when true,
|
53
|
-
|
54
|
-
when false,
|
55
|
-
|
52
|
+
when true, "true"
|
53
|
+
"Yes"
|
54
|
+
when false, "false"
|
55
|
+
"No"
|
56
56
|
when nil
|
57
|
-
|
57
|
+
"Unset"
|
58
58
|
else
|
59
59
|
status
|
60
60
|
end
|
@@ -62,12 +62,12 @@ module ActiveAdmin
|
|
62
62
|
|
63
63
|
def status_to_class(status)
|
64
64
|
case status
|
65
|
-
when
|
66
|
-
|
65
|
+
when "Unset"
|
66
|
+
"unset no"
|
67
67
|
when String, Symbol
|
68
|
-
status.to_s.titleize.gsub(/\s/,
|
68
|
+
status.to_s.titleize.gsub(/\s/, "").underscore
|
69
69
|
else
|
70
|
-
|
70
|
+
""
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -4,18 +4,18 @@ module ActiveAdmin
|
|
4
4
|
builder_method :table_for
|
5
5
|
|
6
6
|
def tag_name
|
7
|
-
|
7
|
+
"table"
|
8
8
|
end
|
9
9
|
|
10
10
|
def build(obj, *attrs)
|
11
|
-
options
|
12
|
-
@sortable
|
13
|
-
@collection
|
11
|
+
options = attrs.extract_options!
|
12
|
+
@sortable = options.delete(:sortable)
|
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
|
18
|
-
@row_class
|
17
|
+
@columns = []
|
18
|
+
@row_class = options.delete(:row_class)
|
19
19
|
|
20
20
|
build_table
|
21
21
|
super(options)
|
@@ -29,7 +29,7 @@ module ActiveAdmin
|
|
29
29
|
def column(*args, &block)
|
30
30
|
options = default_options.merge(args.extract_options!)
|
31
31
|
title = args[0]
|
32
|
-
data
|
32
|
+
data = args[1] || args[0]
|
33
33
|
|
34
34
|
col = Column.new(title, data, @resource_class, options, &block)
|
35
35
|
@columns << col
|
@@ -65,12 +65,12 @@ module ActiveAdmin
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def build_table_header(col)
|
68
|
-
classes
|
68
|
+
classes = Arbre::HTML::ClassList.new
|
69
69
|
sort_key = sortable? && col.sortable? && col.sort_key
|
70
|
-
params
|
70
|
+
params = request.query_parameters.except :page, :order, :commit, :format
|
71
71
|
|
72
|
-
classes <<
|
73
|
-
classes << "sorted-#{current_sort[1]}"
|
72
|
+
classes << "sortable" if sort_key
|
73
|
+
classes << "sorted-#{current_sort[1]}" if sort_key && current_sort[0] == sort_key
|
74
74
|
classes << col.html_class
|
75
75
|
|
76
76
|
if sort_key
|
@@ -86,13 +86,13 @@ module ActiveAdmin
|
|
86
86
|
@tbody = tbody do
|
87
87
|
# Build enough rows for our collection
|
88
88
|
@collection.each do |elem|
|
89
|
-
classes = [helpers.cycle(
|
89
|
+
classes = [helpers.cycle("odd", "even")]
|
90
90
|
|
91
91
|
if @row_class
|
92
92
|
classes << @row_class.call(elem)
|
93
93
|
end
|
94
94
|
|
95
|
-
tr(class: classes.flatten.join(
|
95
|
+
tr(class: classes.flatten.join(" "), id: dom_id_for(elem))
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -126,8 +126,8 @@ module ActiveAdmin
|
|
126
126
|
# 'desc' it will return 'asc'
|
127
127
|
def order_for_sort_key(sort_key)
|
128
128
|
current_key, current_order = current_sort
|
129
|
-
return
|
130
|
-
current_order ==
|
129
|
+
return "desc" unless current_key == sort_key
|
130
|
+
current_order == "desc" ? "asc" : "desc"
|
131
131
|
end
|
132
132
|
|
133
133
|
def default_options
|
@@ -138,7 +138,7 @@ module ActiveAdmin
|
|
138
138
|
|
139
139
|
class Column
|
140
140
|
|
141
|
-
attr_accessor :title, :data
|
141
|
+
attr_accessor :title, :data, :html_class
|
142
142
|
|
143
143
|
def initialize(*args, &block)
|
144
144
|
@options = args.extract_options!
|
@@ -150,7 +150,7 @@ module ActiveAdmin
|
|
150
150
|
elsif @title.present?
|
151
151
|
html_classes << "col-#{@title.to_s.parameterize(separator: "_")}"
|
152
152
|
end
|
153
|
-
@html_class = html_classes.join(
|
153
|
+
@html_class = html_classes.join(" ")
|
154
154
|
@data = args[1] || args[0]
|
155
155
|
@data = block if block
|
156
156
|
@resource_class = args[2]
|
@@ -10,8 +10,8 @@ module ActiveAdmin
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def build(&block)
|
13
|
-
@menu = ul(class:
|
14
|
-
@tabs_content = div(class:
|
13
|
+
@menu = ul(class: "nav nav-tabs", role: "tablist")
|
14
|
+
@tabs_content = div(class: "tab-content")
|
15
15
|
end
|
16
16
|
|
17
17
|
def build_menu_item(title, options, &block)
|
@@ -32,7 +32,7 @@ module ActiveAdmin
|
|
32
32
|
|
33
33
|
def fragmentize(string)
|
34
34
|
result = string.parameterize
|
35
|
-
result =
|
35
|
+
result = CGI.escape(string) if result.blank?
|
36
36
|
result
|
37
37
|
end
|
38
38
|
end
|
@@ -10,8 +10,8 @@ module ActiveAdmin
|
|
10
10
|
@utility_menu = @namespace.fetch_menu(:utility_navigation)
|
11
11
|
|
12
12
|
site_title @namespace
|
13
|
-
global_navigation @menu, class:
|
14
|
-
utility_navigation @utility_menu, id: "utility_nav", class:
|
13
|
+
global_navigation @menu, class: "header-item tabs"
|
14
|
+
utility_navigation @utility_menu, id: "utility_nav", class: "header-item tabs"
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
@@ -278,13 +278,13 @@ module ActiveAdmin
|
|
278
278
|
# Display a column for checkbox
|
279
279
|
def selectable_column
|
280
280
|
return unless active_admin_config.batch_actions.any?
|
281
|
-
column resource_selection_toggle_cell, class:
|
281
|
+
column resource_selection_toggle_cell, class: "col-selectable", sortable: false do |resource|
|
282
282
|
resource_selection_cell resource
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
286
|
def index_column(start_value = 1)
|
287
|
-
column
|
287
|
+
column "#", class: "col-index", sortable: false do |resource|
|
288
288
|
@collection.offset_value + @collection.index(resource) + start_value
|
289
289
|
end
|
290
290
|
end
|
@@ -293,9 +293,9 @@ module ActiveAdmin
|
|
293
293
|
def id_column
|
294
294
|
raise "#{resource_class.name} has no primary_key!" unless resource_class.primary_key
|
295
295
|
column(resource_class.human_attribute_name(resource_class.primary_key), sortable: resource_class.primary_key) do |resource|
|
296
|
-
if controller.action_methods.include?(
|
296
|
+
if controller.action_methods.include?("show")
|
297
297
|
link_to resource.id, resource_path(resource), class: "resource_id_link"
|
298
|
-
elsif controller.action_methods.include?(
|
298
|
+
elsif controller.action_methods.include?("edit")
|
299
299
|
link_to resource.id, edit_resource_path(resource), class: "resource_id_link"
|
300
300
|
else
|
301
301
|
resource.id
|
@@ -304,7 +304,7 @@ module ActiveAdmin
|
|
304
304
|
end
|
305
305
|
|
306
306
|
def default_actions
|
307
|
-
raise
|
307
|
+
raise "`default_actions` is no longer provided in ActiveAdmin 1.x. Use `actions` instead."
|
308
308
|
end
|
309
309
|
|
310
310
|
# Add links to perform actions.
|
@@ -344,12 +344,12 @@ module ActiveAdmin
|
|
344
344
|
#
|
345
345
|
# ```
|
346
346
|
def actions(options = {}, &block)
|
347
|
-
name
|
348
|
-
defaults
|
349
|
-
dropdown
|
350
|
-
dropdown_name = options.delete(:dropdown_name) { I18n.t
|
347
|
+
name = options.delete(:name) { "" }
|
348
|
+
defaults = options.delete(:defaults) { true }
|
349
|
+
dropdown = options.delete(:dropdown) { false }
|
350
|
+
dropdown_name = options.delete(:dropdown_name) { I18n.t "active_admin.dropdown_actions.button_label", default: "Actions" }
|
351
351
|
|
352
|
-
options[:class] ||=
|
352
|
+
options[:class] ||= "col-actions"
|
353
353
|
|
354
354
|
column name, options do |resource|
|
355
355
|
if dropdown
|
@@ -373,23 +373,23 @@ module ActiveAdmin
|
|
373
373
|
|
374
374
|
def defaults(resource, options = {})
|
375
375
|
localizer = ActiveAdmin::Localizers.resource(active_admin_config)
|
376
|
-
if controller.action_methods.include?(
|
376
|
+
if controller.action_methods.include?("show") && authorized?(ActiveAdmin::Auth::READ, resource)
|
377
377
|
item localizer.t(:view), resource_path(resource), class: "view_link #{options[:css_class]}", title: localizer.t(:view)
|
378
378
|
end
|
379
|
-
if controller.action_methods.include?(
|
379
|
+
if controller.action_methods.include?("edit") && authorized?(ActiveAdmin::Auth::UPDATE, resource)
|
380
380
|
item localizer.t(:edit), edit_resource_path(resource), class: "edit_link #{options[:css_class]}", title: localizer.t(:edit)
|
381
381
|
end
|
382
|
-
if controller.action_methods.include?(
|
382
|
+
if controller.action_methods.include?("destroy") && authorized?(ActiveAdmin::Auth::DESTROY, resource)
|
383
383
|
item localizer.t(:delete), resource_path(resource), class: "delete_link #{options[:css_class]}", title: localizer.t(:delete),
|
384
|
-
|
384
|
+
method: :delete, data: { confirm: localizer.t(:delete_confirmation) }
|
385
385
|
end
|
386
386
|
end
|
387
387
|
|
388
388
|
class TableActions < ActiveAdmin::Component
|
389
389
|
builder_method :table_actions
|
390
390
|
|
391
|
-
def item *args
|
392
|
-
text_node link_to
|
391
|
+
def item *args, **kwargs
|
392
|
+
text_node link_to(*args, **kwargs)
|
393
393
|
end
|
394
394
|
end
|
395
395
|
end # IndexTableFor
|
@@ -15,7 +15,7 @@ module ActiveAdmin
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def main_content
|
18
|
-
I18n.t(
|
18
|
+
I18n.t("active_admin.main_content", model: title).html_safe
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -29,7 +29,8 @@ 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|
|
@@ -37,7 +38,8 @@ module ActiveAdmin
|
|
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
|
@@ -63,9 +65,9 @@ module ActiveAdmin
|
|
63
65
|
def body_classes
|
64
66
|
Arbre::HTML::ClassList.new [
|
65
67
|
params[:action],
|
66
|
-
params[:controller].tr(
|
67
|
-
|
68
|
-
active_admin_namespace.name.to_s +
|
68
|
+
params[:controller].tr("/", "_"),
|
69
|
+
"active_admin", "logged_in",
|
70
|
+
active_admin_namespace.name.to_s + "_namespace"
|
69
71
|
]
|
70
72
|
end
|
71
73
|
|
@@ -79,14 +81,16 @@ module ActiveAdmin
|
|
79
81
|
build_flash_messages
|
80
82
|
div id: "active_admin_content", class: (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
|
81
83
|
build_main_content_wrapper
|
82
|
-
sidebar sidebar_sections_for_action, id:
|
84
|
+
sidebar sidebar_sections_for_action, id: "sidebar" unless skip_sidebar?
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
86
88
|
def build_flash_messages
|
87
|
-
div class:
|
88
|
-
flash_messages.each do |type,
|
89
|
-
|
89
|
+
div class: "flashes" do
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "active_admin/helpers/collection"
|
2
2
|
|
3
3
|
module ActiveAdmin
|
4
4
|
module Views
|
@@ -111,7 +111,7 @@ module ActiveAdmin
|
|
111
111
|
|
112
112
|
def render_blank_slate
|
113
113
|
blank_slate_content = I18n.t("active_admin.blank_slate.content", resource_name: active_admin_config.plural_resource_label)
|
114
|
-
if controller.action_methods.include?(
|
114
|
+
if controller.action_methods.include?("new") && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
|
115
115
|
blank_slate_content = [blank_slate_content, blank_slate_link].compact.join(" ")
|
116
116
|
end
|
117
117
|
insert_tag(view_factory.blank_slate, blank_slate_content)
|
@@ -125,18 +125,19 @@ module ActiveAdmin
|
|
125
125
|
def render_index
|
126
126
|
renderer_class = find_index_renderer_class(config[:as])
|
127
127
|
|
128
|
-
paginator
|
129
|
-
download_links
|
128
|
+
paginator = config.fetch(:paginator, true)
|
129
|
+
download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
|
130
130
|
pagination_total = config.fetch(:pagination_total, true)
|
131
|
-
per_page
|
132
|
-
|
133
|
-
paginated_collection(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
131
|
+
per_page = config.fetch(:per_page, active_admin_config.per_page)
|
132
|
+
|
133
|
+
paginated_collection(
|
134
|
+
collection, entry_name: active_admin_config.resource_label,
|
135
|
+
entries_name: active_admin_config.plural_resource_label(count: collection_size),
|
136
|
+
download_links: download_links,
|
137
|
+
paginator: paginator,
|
138
|
+
per_page: per_page,
|
139
|
+
pagination_total: pagination_total) do
|
140
|
+
div class: "index_content" do
|
140
141
|
insert_tag(renderer_class, config, collection)
|
141
142
|
end
|
142
143
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "components/menu"
|
2
2
|
|
3
3
|
module ActiveAdmin
|
4
4
|
module Views
|
5
5
|
class TabbedNavigation < Menu
|
6
6
|
def build(menu, options = {})
|
7
|
-
super(menu, options.reverse_merge(id:
|
7
|
+
super(menu, options.reverse_merge(id: "tabs"))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/activeadmin.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "active_admin"
|
@@ -2,10 +2,10 @@ module ActiveAdmin
|
|
2
2
|
module Generators
|
3
3
|
class AssetsGenerator < Rails::Generators::Base
|
4
4
|
|
5
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path("templates", __dir__)
|
6
6
|
|
7
7
|
def install_assets
|
8
|
-
template
|
8
|
+
template "active_admin.js", "app/assets/javascripts/active_admin.js"
|
9
9
|
template "active_admin.scss", "app/assets/stylesheets/active_admin.scss"
|
10
10
|
end
|
11
11
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
//
|
1
|
+
// Sass variable overrides must be declared before loading up Active Admin's styles.
|
2
2
|
//
|
3
3
|
// To view the variables that Active Admin provides, take a look at
|
4
4
|
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
|
@@ -11,7 +11,7 @@
|
|
11
11
|
@import "active_admin/mixins";
|
12
12
|
@import "active_admin/base";
|
13
13
|
|
14
|
-
// Overriding any non-variable
|
14
|
+
// Overriding any non-variable Sass must be done after the fact.
|
15
15
|
// For example, to change the default status-tag color:
|
16
16
|
//
|
17
17
|
// .status_tag { background: #6090DB; }
|