activeadmin 2.8.1 → 2.10.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 +118 -1
- data/CONTRIBUTING.md +6 -6
- data/README.md +3 -3
- data/app/assets/javascripts/active_admin/base.js +12 -5
- data/app/assets/stylesheets/active_admin/_base.scss +53 -37
- data/app/assets/stylesheets/active_admin/_forms.scss +3 -4
- data/app/assets/stylesheets/active_admin/_normalize.scss +25 -123
- data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +0 -0
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -1
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -1
- data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
- data/app/views/active_admin/devise/shared/_links.erb +1 -1
- data/app/views/active_admin/page/index.html.arb +1 -0
- data/app/views/active_admin/resource/edit.html.arb +1 -0
- data/app/views/active_admin/resource/index.html.arb +1 -0
- data/app/views/active_admin/resource/new.html.arb +1 -0
- data/app/views/active_admin/resource/show.html.arb +1 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/config/locales/ko.yml +1 -1
- data/config/locales/nl.yml +1 -1
- data/config/locales/ro.yml +3 -2
- data/docs/0-installation.md +1 -1
- data/docs/5-forms.md +6 -1
- data/docs/6-show-pages.md +12 -0
- data/docs/8-custom-actions.md +1 -1
- data/docs/Gemfile +1 -0
- data/docs/Gemfile.lock +114 -90
- data/lib/active_admin/abstract_view_factory.rb +1 -0
- data/lib/active_admin/application.rb +9 -9
- data/lib/active_admin/application_settings.rb +1 -0
- data/lib/active_admin/asset_registration.rb +1 -0
- data/lib/active_admin/authorization_adapter.rb +1 -0
- data/lib/active_admin/base_controller/authorization.rb +1 -0
- data/lib/active_admin/base_controller/menu.rb +1 -0
- data/lib/active_admin/base_controller.rb +2 -1
- data/lib/active_admin/batch_actions/controller.rb +1 -0
- data/lib/active_admin/batch_actions/resource_extension.rb +1 -0
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -0
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +1 -0
- data/lib/active_admin/batch_actions/views/selection_cells.rb +1 -0
- data/lib/active_admin/batch_actions.rb +1 -0
- data/lib/active_admin/callbacks.rb +1 -0
- data/lib/active_admin/cancan_adapter.rb +1 -0
- data/lib/active_admin/collection_decorator.rb +1 -0
- data/lib/active_admin/component.rb +1 -0
- data/lib/active_admin/controller_action.rb +1 -0
- data/lib/active_admin/csv_builder.rb +1 -0
- data/lib/active_admin/dependency.rb +2 -1
- data/lib/active_admin/deprecation.rb +1 -0
- data/lib/active_admin/devise.rb +11 -0
- data/lib/active_admin/dsl.rb +1 -0
- data/lib/active_admin/dynamic_setting.rb +1 -0
- data/lib/active_admin/dynamic_settings_node.rb +1 -0
- data/lib/active_admin/engine.rb +8 -5
- data/lib/active_admin/error.rb +1 -2
- data/lib/active_admin/filters/active.rb +1 -0
- data/lib/active_admin/filters/active_filter.rb +1 -2
- data/lib/active_admin/filters/active_sidebar.rb +2 -28
- data/lib/active_admin/filters/dsl.rb +1 -0
- data/lib/active_admin/filters/forms.rb +1 -0
- data/lib/active_admin/filters/formtastic_addons.rb +1 -0
- data/lib/active_admin/filters/resource_extension.rb +1 -0
- data/lib/active_admin/filters.rb +1 -0
- data/lib/active_admin/form_builder.rb +5 -2
- data/lib/active_admin/generators/boilerplate.rb +1 -0
- data/lib/active_admin/helpers/collection.rb +2 -0
- data/lib/active_admin/helpers/i18n.rb +1 -0
- data/lib/active_admin/helpers/optional_display.rb +1 -0
- data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
- data/lib/active_admin/helpers/scope_chain.rb +1 -0
- data/lib/active_admin/inputs/datepicker_input.rb +1 -0
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +1 -0
- data/lib/active_admin/inputs/filters/base.rb +1 -0
- data/lib/active_admin/inputs/filters/boolean_input.rb +1 -0
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -0
- data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +1 -0
- data/lib/active_admin/inputs/filters/numeric_input.rb +1 -0
- data/lib/active_admin/inputs/filters/select_input.rb +1 -0
- data/lib/active_admin/inputs/filters/string_input.rb +1 -0
- data/lib/active_admin/inputs/filters/text_input.rb +1 -0
- data/lib/active_admin/inputs.rb +1 -0
- data/lib/active_admin/localizers/resource_localizer.rb +1 -0
- data/lib/active_admin/localizers.rb +1 -0
- data/lib/active_admin/menu.rb +1 -0
- data/lib/active_admin/menu_collection.rb +1 -0
- data/lib/active_admin/menu_item.rb +1 -0
- data/lib/active_admin/namespace.rb +2 -1
- data/lib/active_admin/namespace_settings.rb +1 -0
- data/lib/active_admin/order_clause.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/comment.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/views.rb +1 -0
- data/lib/active_admin/orm/active_record/comments.rb +1 -0
- data/lib/active_admin/orm/active_record.rb +1 -0
- data/lib/active_admin/orm/mongoid.rb +1 -0
- data/lib/active_admin/page.rb +1 -0
- data/lib/active_admin/page_controller.rb +1 -0
- data/lib/active_admin/page_dsl.rb +1 -0
- data/lib/active_admin/page_presenter.rb +1 -0
- data/lib/active_admin/pundit_adapter.rb +1 -0
- data/lib/active_admin/resource/action_items.rb +1 -0
- data/lib/active_admin/resource/attributes.rb +1 -0
- data/lib/active_admin/resource/belongs_to.rb +1 -0
- data/lib/active_admin/resource/controllers.rb +1 -0
- data/lib/active_admin/resource/includes.rb +1 -0
- data/lib/active_admin/resource/menu.rb +1 -0
- data/lib/active_admin/resource/model.rb +1 -0
- data/lib/active_admin/resource/naming.rb +1 -0
- data/lib/active_admin/resource/ordering.rb +1 -0
- data/lib/active_admin/resource/page_presenters.rb +1 -0
- data/lib/active_admin/resource/pagination.rb +1 -0
- data/lib/active_admin/resource/routes.rb +1 -2
- data/lib/active_admin/resource/scope_to.rb +1 -0
- data/lib/active_admin/resource/scopes.rb +1 -0
- data/lib/active_admin/resource/sidebars.rb +1 -0
- data/lib/active_admin/resource.rb +1 -0
- data/lib/active_admin/resource_collection.rb +1 -0
- data/lib/active_admin/resource_controller/action_builder.rb +1 -0
- data/lib/active_admin/resource_controller/data_access.rb +3 -2
- data/lib/active_admin/resource_controller/decorators.rb +1 -2
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +1 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
- data/lib/active_admin/resource_controller/scoping.rb +1 -0
- data/lib/active_admin/resource_controller/sidebars.rb +1 -0
- data/lib/active_admin/resource_controller/streaming.rb +2 -1
- data/lib/active_admin/resource_controller.rb +1 -0
- data/lib/active_admin/resource_dsl.rb +7 -21
- data/lib/active_admin/router.rb +1 -0
- data/lib/active_admin/scope.rb +1 -0
- data/lib/active_admin/settings_node.rb +1 -0
- data/lib/active_admin/sidebar_section.rb +1 -0
- data/lib/active_admin/version.rb +2 -1
- data/lib/active_admin/view_factory.rb +1 -0
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -0
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +1 -0
- data/lib/active_admin/view_helpers/display_helper.rb +11 -3
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -0
- data/lib/active_admin/view_helpers/fields_for.rb +1 -0
- data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
- data/lib/active_admin/view_helpers/form_helper.rb +1 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
- data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
- data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
- data/lib/active_admin/view_helpers/title_helper.rb +1 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
- data/lib/active_admin/view_helpers.rb +1 -0
- data/lib/active_admin/views/action_items.rb +1 -0
- data/lib/active_admin/views/components/active_admin_form.rb +2 -1
- data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
- data/lib/active_admin/views/components/attributes_table.rb +1 -0
- data/lib/active_admin/views/components/blank_slate.rb +1 -0
- data/lib/active_admin/views/components/columns.rb +1 -0
- data/lib/active_admin/views/components/dropdown_menu.rb +3 -5
- data/lib/active_admin/views/components/index_list.rb +1 -0
- data/lib/active_admin/views/components/menu.rb +1 -0
- data/lib/active_admin/views/components/menu_item.rb +1 -0
- data/lib/active_admin/views/components/paginated_collection.rb +1 -0
- data/lib/active_admin/views/components/panel.rb +1 -0
- data/lib/active_admin/views/components/scopes.rb +1 -0
- data/lib/active_admin/views/components/sidebar.rb +1 -0
- data/lib/active_admin/views/components/sidebar_section.rb +1 -0
- data/lib/active_admin/views/components/site_title.rb +1 -0
- data/lib/active_admin/views/components/status_tag.rb +1 -0
- data/lib/active_admin/views/components/table_for.rb +1 -0
- data/lib/active_admin/views/components/tabs.rb +1 -0
- data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
- data/lib/active_admin/views/footer.rb +1 -0
- data/lib/active_admin/views/header.rb +1 -0
- data/lib/active_admin/views/index_as_block.rb +1 -0
- data/lib/active_admin/views/index_as_blog.rb +1 -0
- data/lib/active_admin/views/index_as_grid.rb +1 -0
- data/lib/active_admin/views/index_as_table.rb +1 -0
- data/lib/active_admin/views/pages/base.rb +4 -1
- data/lib/active_admin/views/pages/form.rb +1 -0
- data/lib/active_admin/views/pages/index.rb +1 -0
- data/lib/active_admin/views/pages/layout.rb +1 -0
- data/lib/active_admin/views/pages/page.rb +1 -0
- data/lib/active_admin/views/pages/show.rb +1 -0
- data/lib/active_admin/views/tabbed_navigation.rb +1 -0
- data/lib/active_admin/views/title_bar.rb +1 -0
- data/lib/active_admin/views.rb +1 -0
- data/lib/active_admin.rb +2 -2
- data/lib/activeadmin.rb +1 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +1 -0
- data/lib/generators/active_admin/devise/devise_generator.rb +1 -0
- data/lib/generators/active_admin/install/install_generator.rb +1 -0
- data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
- data/lib/generators/active_admin/page/page_generator.rb +1 -0
- data/lib/generators/active_admin/page/templates/page.rb +1 -0
- data/lib/generators/active_admin/resource/resource_generator.rb +1 -0
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +1 -0
- data/lib/ransack_ext.rb +1 -0
- metadata +13 -46
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "active_admin/filters/active"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
@@ -9,34 +10,7 @@ module ActiveAdmin
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def block
|
12
|
-
->
|
13
|
-
active_filters = ActiveAdmin::Filters::Active.new(active_admin_config, assigns[:search])
|
14
|
-
span do
|
15
|
-
if current_scope
|
16
|
-
h4 I18n.t("active_admin.search_status.current_scope"), style: "display: inline"
|
17
|
-
b scope_name(current_scope), class: "current_scope_name", style: "display: inline"
|
18
|
-
end
|
19
|
-
div style: "margin-top: 10px" do
|
20
|
-
h4 I18n.t("active_admin.search_status.current_filters"), style: "margin-bottom: 10px"
|
21
|
-
ul do
|
22
|
-
if active_filters.filters.blank?
|
23
|
-
li I18n.t("active_admin.search_status.no_current_filters")
|
24
|
-
else
|
25
|
-
active_filters.filters.each do |filter|
|
26
|
-
li filter.html_options do
|
27
|
-
span do
|
28
|
-
text_node filter.label
|
29
|
-
end
|
30
|
-
b do
|
31
|
-
text_node to_sentence(filter.values.map { |v| pretty_format(v) })
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
13
|
+
-> { active_filters_sidebar_content }
|
40
14
|
end
|
41
15
|
|
42
16
|
def title
|
data/lib/active_admin/filters.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Provides an intuitive way to build has_many associated records in the same form.
|
2
3
|
module Formtastic
|
3
4
|
module Inputs
|
@@ -40,7 +41,7 @@ module ActiveAdmin
|
|
40
41
|
attr_reader :assoc
|
41
42
|
attr_reader :options
|
42
43
|
attr_reader :heading, :sortable_column, :sortable_start
|
43
|
-
attr_reader :new_record, :destroy_option
|
44
|
+
attr_reader :new_record, :destroy_option, :remove_record
|
44
45
|
|
45
46
|
def initialize(has_many_form, assoc, options)
|
46
47
|
super has_many_form
|
@@ -72,6 +73,7 @@ module ActiveAdmin
|
|
72
73
|
@sortable_start = options.delete(:sortable_start) || 0
|
73
74
|
@new_record = options.key?(:new_record) ? options.delete(:new_record) : true
|
74
75
|
@destroy_option = options.delete(:allow_destroy)
|
76
|
+
@remove_record = options.delete(:remove_record)
|
75
77
|
options
|
76
78
|
end
|
77
79
|
|
@@ -107,7 +109,8 @@ module ActiveAdmin
|
|
107
109
|
def has_many_actions(form_builder, contents)
|
108
110
|
if form_builder.object.new_record?
|
109
111
|
contents << template.content_tag(:li) do
|
110
|
-
|
112
|
+
remove_text = remove_record.is_a?(String) ? remove_record : I18n.t("active_admin.has_many_remove")
|
113
|
+
template.link_to remove_text, "#", class: "button has_many_remove"
|
111
114
|
end
|
112
115
|
elsif allow_destroy?(form_builder.object)
|
113
116
|
form_builder.input(
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Helpers
|
3
4
|
module Collection
|
@@ -5,6 +6,7 @@ module ActiveAdmin
|
|
5
6
|
# 2. correctly handles the Hash returned when `group by` is used
|
6
7
|
def collection_size(c = collection)
|
7
8
|
return c.count if c.is_a?(Array)
|
9
|
+
return c.length if c.limit_value
|
8
10
|
|
9
11
|
c = c.except :select, :order
|
10
12
|
|
data/lib/active_admin/inputs.rb
CHANGED
data/lib/active_admin/menu.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "active_admin/resource_collection"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
@@ -71,7 +72,7 @@ module ActiveAdmin
|
|
71
72
|
reset_menu!
|
72
73
|
|
73
74
|
# Dispatch a registration event
|
74
|
-
ActiveSupport::Notifications.
|
75
|
+
ActiveSupport::Notifications.instrument ActiveAdmin::Resource::RegisterEvent, config
|
75
76
|
|
76
77
|
# Return the config
|
77
78
|
config
|
data/lib/active_admin/page.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
class Resource
|
3
4
|
module Routes
|
@@ -42,8 +43,6 @@ module ActiveAdmin
|
|
42
43
|
config[:route_collection_name] == config[:route_instance_name]
|
43
44
|
end
|
44
45
|
|
45
|
-
private
|
46
|
-
|
47
46
|
class RouteBuilder
|
48
47
|
def initialize(resource)
|
49
48
|
@resource = resource
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
class ResourceController < BaseController
|
3
4
|
|
@@ -23,9 +24,9 @@ module ActiveAdmin
|
|
23
24
|
|
24
25
|
COLLECTION_APPLIES = [
|
25
26
|
:authorization_scope,
|
26
|
-
:sorting,
|
27
27
|
:filtering,
|
28
28
|
:scoping,
|
29
|
+
:sorting,
|
29
30
|
:includes,
|
30
31
|
:pagination,
|
31
32
|
:collection_decorator
|
@@ -128,7 +129,7 @@ module ActiveAdmin
|
|
128
129
|
#
|
129
130
|
# @return [ActiveRecord::Base] An un-saved active record base object
|
130
131
|
def build_new_resource
|
131
|
-
scoped_collection.send(
|
132
|
+
apply_authorization_scope(scoped_collection).send(
|
132
133
|
method_for_build,
|
133
134
|
*resource_params.map { |params| params.slice(active_admin_config.resource_class.inheritance_column) }
|
134
135
|
)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
class ResourceController < BaseController
|
3
4
|
module Decorators
|
@@ -57,8 +58,6 @@ module ActiveAdmin
|
|
57
58
|
@cache[name] ||= wrap! collection_decorator, name
|
58
59
|
end
|
59
60
|
|
60
|
-
private
|
61
|
-
|
62
61
|
def self.wrap!(parent, name)
|
63
62
|
::Class.new parent do
|
64
63
|
delegate :reorder, :page, :current_page, :total_pages, :limit_value,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "csv"
|
2
3
|
|
3
4
|
module ActiveAdmin
|
@@ -23,7 +24,7 @@ module ActiveAdmin
|
|
23
24
|
headers["Last-Modified"] = Time.current.httpdate
|
24
25
|
|
25
26
|
if ActiveAdmin.application.disable_streaming_in.include? Rails.env
|
26
|
-
self.response_body = block[
|
27
|
+
self.response_body = block[String.new]
|
27
28
|
else
|
28
29
|
self.response_body = Enumerator.new &block
|
29
30
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
# This is the class where all the register blocks are evaluated.
|
3
4
|
class ResourceDSL < DSL
|
@@ -62,11 +63,12 @@ module ActiveAdmin
|
|
62
63
|
#
|
63
64
|
def permit_params(*args, &block)
|
64
65
|
param_key = config.param_key.to_sym
|
65
|
-
belongs_to_param = config.belongs_to_param
|
66
|
-
create_another_param = :create_another if config.create_another
|
67
66
|
|
68
67
|
controller do
|
69
68
|
define_method :permitted_params do
|
69
|
+
belongs_to_param = active_admin_config.belongs_to_param
|
70
|
+
create_another_param = :create_another if active_admin_config.create_another
|
71
|
+
|
70
72
|
permitted_params =
|
71
73
|
active_admin_namespace.permitted_params +
|
72
74
|
Array.wrap(belongs_to_param) +
|
@@ -189,25 +191,9 @@ module ActiveAdmin
|
|
189
191
|
delegate :before_save, :after_save, to: :controller
|
190
192
|
delegate :before_destroy, :after_destroy, to: :controller
|
191
193
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
:after, :skip_after,
|
196
|
-
:around, :skip
|
197
|
-
]
|
198
|
-
keywords = if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1
|
199
|
-
[:action]
|
200
|
-
else
|
201
|
-
[:action, :filter]
|
202
|
-
end
|
203
|
-
|
204
|
-
keywords.each do |name|
|
205
|
-
phases.each do |action|
|
206
|
-
define_method "#{action}_#{name}" do |*args, &block|
|
207
|
-
controller.public_send "#{action}_action", *args, &block
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
194
|
+
standard_rails_filters =
|
195
|
+
AbstractController::Callbacks::ClassMethods.public_instance_methods.select { |m| m.match(/_action\z/) }
|
196
|
+
delegate *standard_rails_filters, to: :controller
|
211
197
|
|
212
198
|
# Specify which actions to create in the controller
|
213
199
|
#
|
data/lib/active_admin/router.rb
CHANGED
data/lib/active_admin/scope.rb
CHANGED