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
data/lib/active_admin/version.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module ViewHelpers
|
3
4
|
module DisplayHelper
|
4
5
|
|
5
6
|
DISPLAY_NAME_FALLBACK = -> {
|
6
|
-
name = ""
|
7
7
|
klass = self.class
|
8
|
-
name
|
9
|
-
|
8
|
+
name = if klass.respond_to?(:model_name)
|
9
|
+
if klass.respond_to?(:primary_key)
|
10
|
+
"#{klass.model_name.human} ##{send(klass.primary_key)}"
|
11
|
+
else
|
12
|
+
klass.model_name.human
|
13
|
+
end
|
14
|
+
elsif klass.respond_to?(:primary_key)
|
15
|
+
" ##{send(klass.primary_key)}"
|
16
|
+
end
|
10
17
|
name.present? ? name : to_s
|
11
18
|
}
|
19
|
+
|
12
20
|
def DISPLAY_NAME_FALLBACK.inspect
|
13
21
|
"DISPLAY_NAME_FALLBACK"
|
14
22
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
class FormtasticProxy < ::Arbre::Rails::Forms::FormBuilderProxy
|
@@ -16,7 +17,7 @@ module ActiveAdmin
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def to_s
|
19
|
-
opening_tag
|
20
|
+
opening_tag + children.to_s + closing_tag
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "active_admin/filters/active"
|
3
|
+
|
4
|
+
module ActiveAdmin
|
5
|
+
module Views
|
6
|
+
|
7
|
+
class ActiveFiltersSidebarContent < ActiveAdmin::Component
|
8
|
+
builder_method :active_filters_sidebar_content
|
9
|
+
|
10
|
+
def build
|
11
|
+
active_filters = ActiveAdmin::Filters::Active.new(active_admin_config, assigns[:search])
|
12
|
+
active_scopes = assigns[:search].instance_variable_get("@scope_args")
|
13
|
+
|
14
|
+
scope_block(current_scope)
|
15
|
+
filters_list(active_filters, active_scopes)
|
16
|
+
end
|
17
|
+
|
18
|
+
def scope_block(current_scope)
|
19
|
+
return unless current_scope
|
20
|
+
|
21
|
+
h4 I18n.t("active_admin.search_status.current_scope"), style: "display: inline"
|
22
|
+
b scope_name(current_scope), class: "current_scope_name"
|
23
|
+
end
|
24
|
+
|
25
|
+
def filters_list(active_filters, active_scopes)
|
26
|
+
div style: "margin-top: 10px" do
|
27
|
+
h4 I18n.t("active_admin.search_status.current_filters"), style: "margin-bottom: 10px"
|
28
|
+
ul do
|
29
|
+
if active_filters.filters.blank? && active_scopes.blank?
|
30
|
+
li I18n.t("active_admin.search_status.no_current_filters")
|
31
|
+
else
|
32
|
+
active_filters.filters.each { |filter| filter_item(filter) }
|
33
|
+
active_scopes.each { |name, value| scope_item(name, value) }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def filter_item(filter)
|
40
|
+
li filter.html_options do
|
41
|
+
span filter.label
|
42
|
+
b to_sentence(filter.values.map { |v| pretty_format(v) })
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def scope_item(name, value)
|
47
|
+
filter_name = name.gsub(/_eq$/, "")
|
48
|
+
filter = active_admin_config.filters[filter_name.to_sym]
|
49
|
+
label = filter.try(:[], :label) || filter_name.titleize
|
50
|
+
|
51
|
+
li class: "current_filter_#{name}" do
|
52
|
+
span "#{label} #{Ransack::Translate.predicate('eq')}"
|
53
|
+
b value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
|
@@ -44,17 +45,14 @@ module ActiveAdmin
|
|
44
45
|
private
|
45
46
|
|
46
47
|
def build_button(name, button_options)
|
47
|
-
button_options[:class]
|
48
|
-
button_options[:class] << " dropdown_menu_button"
|
49
|
-
|
48
|
+
button_options[:class] = "#{button_options[:class]} dropdown_menu_button"
|
50
49
|
button_options[:href] = "#"
|
51
50
|
|
52
51
|
a name, button_options
|
53
52
|
end
|
54
53
|
|
55
54
|
def build_menu(options)
|
56
|
-
options[:class]
|
57
|
-
options[:class] << " dropdown_menu_list"
|
55
|
+
options[:class] = "#{options[:class]} dropdown_menu_list"
|
58
56
|
|
59
57
|
menu_list = nil
|
60
58
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ActiveAdmin
|
2
3
|
module Views
|
3
4
|
module Pages
|
@@ -43,7 +44,9 @@ module ActiveAdmin
|
|
43
44
|
end
|
44
45
|
|
45
46
|
if active_admin_namespace.favicon
|
46
|
-
|
47
|
+
favicon = active_admin_namespace.favicon
|
48
|
+
favicon_tag = active_admin_namespace.use_webpacker ? favicon_pack_tag(favicon) : favicon_link_tag(favicon)
|
49
|
+
text_node(favicon_tag)
|
47
50
|
end
|
48
51
|
|
49
52
|
text_node csrf_meta_tag
|
data/lib/active_admin/views.rb
CHANGED
data/lib/active_admin.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "active_support/core_ext"
|
2
3
|
require "set"
|
3
4
|
|
@@ -8,7 +9,6 @@ require "formtastic"
|
|
8
9
|
require "formtastic_i18n"
|
9
10
|
require "inherited_resources"
|
10
11
|
require "jquery-rails"
|
11
|
-
require "sassc-rails"
|
12
12
|
require "arbre"
|
13
13
|
|
14
14
|
require "active_admin/helpers/i18n"
|
@@ -113,7 +113,7 @@ module ActiveAdmin
|
|
113
113
|
private
|
114
114
|
|
115
115
|
def wrap_block_for_active_support_notifications block
|
116
|
-
proc { |
|
116
|
+
proc { |_name, _start, _finish, _id, payload| block.call payload }
|
117
117
|
end
|
118
118
|
|
119
119
|
end
|
data/lib/activeadmin.rb
CHANGED
data/lib/ransack_ext.rb
CHANGED