activeadmin 2.8.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 +11 -0
- data/app/assets/javascripts/active_admin/base.js +1 -1
- data/docs/Gemfile +2 -2
- data/lib/active_admin.rb +56 -56
- data/lib/active_admin/application.rb +8 -8
- data/lib/active_admin/application_settings.rb +3 -3
- data/lib/active_admin/base_controller.rb +4 -4
- data/lib/active_admin/base_controller/authorization.rb +4 -3
- data/lib/active_admin/batch_actions/controller.rb +1 -1
- data/lib/active_admin/batch_actions/resource_extension.rb +9 -8
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +2 -2
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +1 -1
- 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/dependency.rb +4 -4
- 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 +6 -6
- 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 +3 -3
- data/lib/active_admin/filters/formtastic_addons.rb +1 -6
- data/lib/active_admin/form_builder.rb +18 -16
- data/lib/active_admin/generators/boilerplate.rb +1 -1
- 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 +2 -2
- 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/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 +1 -1
- data/lib/active_admin/menu_item.rb +1 -1
- data/lib/active_admin/namespace.rb +7 -7
- data/lib/active_admin/namespace_settings.rb +5 -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 +13 -13
- 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 +17 -17
- data/lib/active_admin/page.rb +1 -1
- data/lib/active_admin/pundit_adapter.rb +1 -1
- data/lib/active_admin/resource.rb +17 -17
- data/lib/active_admin/resource/action_items.rb +4 -4
- 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/naming.rb +2 -2
- data/lib/active_admin/resource/routes.rb +1 -1
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource_controller.rb +9 -9
- data/lib/active_admin/resource_controller/decorators.rb +1 -1
- data/lib/active_admin/resource_controller/streaming.rb +7 -6
- data/lib/active_admin/scope.rb +1 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +1 -1
- data/lib/active_admin/view_helpers.rb +1 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +2 -2
- data/lib/active_admin/view_helpers/display_helper.rb +2 -2
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -1
- data/lib/active_admin/view_helpers/fields_for.rb +1 -1
- 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 +3 -3
- data/lib/active_admin/views/components/blank_slate.rb +1 -1
- data/lib/active_admin/views/components/dropdown_menu.rb +6 -6
- data/lib/active_admin/views/components/index_list.rb +2 -2
- data/lib/active_admin/views/components/menu.rb +1 -1
- data/lib/active_admin/views/components/menu_item.rb +3 -3
- data/lib/active_admin/views/components/paginated_collection.rb +6 -6
- data/lib/active_admin/views/components/panel.rb +1 -1
- data/lib/active_admin/views/components/scopes.rb +5 -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 +7 -7
- data/lib/active_admin/views/components/tabs.rb +2 -2
- 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 +11 -11
- data/lib/active_admin/views/pages/base.rb +6 -6
- data/lib/active_admin/views/pages/index.rb +10 -9
- 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/devise/devise_generator.rb +1 -1
- data/lib/generators/active_admin/install/install_generator.rb +7 -7
- data/lib/generators/active_admin/page/page_generator.rb +1 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +2 -2
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +7 -7
- data/lib/ransack_ext.rb +8 -8
- metadata +2 -2
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "active_admin/orm/active_record/comments/views"
|
2
|
+
require "active_admin/orm/active_record/comments/show_page_helper"
|
3
|
+
require "active_admin/orm/active_record/comments/namespace_helper"
|
4
|
+
require "active_admin/orm/active_record/comments/resource_helper"
|
5
5
|
|
6
6
|
# Add the comments configuration
|
7
7
|
ActiveAdmin::Application.inheritable_setting :comments, true
|
8
|
-
ActiveAdmin::Application.inheritable_setting :comments_registration_name,
|
8
|
+
ActiveAdmin::Application.inheritable_setting :comments_registration_name, "Comment"
|
9
9
|
ActiveAdmin::Application.inheritable_setting :comments_order, "created_at ASC"
|
10
10
|
ActiveAdmin::Application.inheritable_setting :comments_menu, {}
|
11
11
|
|
@@ -15,7 +15,7 @@ ActiveAdmin::Resource.send :include, ActiveAdmin::Comments::ResourceHelper
|
|
15
15
|
ActiveAdmin.application.view_factory.show_page.send :include, ActiveAdmin::Comments::ShowPageHelper
|
16
16
|
|
17
17
|
# Load the model as soon as it's referenced. By that point, Rails & Kaminari will be ready
|
18
|
-
ActiveAdmin.autoload :Comment,
|
18
|
+
ActiveAdmin.autoload :Comment, "active_admin/orm/active_record/comments/comment"
|
19
19
|
|
20
20
|
# Hint i18n-tasks about model and attribute translations used by default install
|
21
21
|
# i18n-tasks-use t('activerecord.models.comment')
|
@@ -67,7 +67,7 @@ ActiveAdmin.after_load do |app|
|
|
67
67
|
redirect_back fallback_location: active_admin_root
|
68
68
|
end
|
69
69
|
failure.html do
|
70
|
-
flash[:error] = I18n.t
|
70
|
+
flash[:error] = I18n.t "active_admin.comments.errors.empty_text"
|
71
71
|
redirect_back fallback_location: active_admin_root
|
72
72
|
end
|
73
73
|
end
|
@@ -88,12 +88,12 @@ ActiveAdmin.after_load do |app|
|
|
88
88
|
permit_params :body, :namespace, :resource_id, :resource_type
|
89
89
|
|
90
90
|
index do
|
91
|
-
column I18n.t(
|
92
|
-
column I18n.t(
|
93
|
-
column I18n.t(
|
94
|
-
column I18n.t(
|
95
|
-
column I18n.t(
|
96
|
-
column I18n.t(
|
91
|
+
column I18n.t("active_admin.comments.resource_type"), :resource_type
|
92
|
+
column I18n.t("active_admin.comments.author_type"), :author_type
|
93
|
+
column I18n.t("active_admin.comments.resource"), :resource
|
94
|
+
column I18n.t("active_admin.comments.author"), :author
|
95
|
+
column I18n.t("active_admin.comments.body"), :body
|
96
|
+
column I18n.t("active_admin.comments.created_at"), :created_at
|
97
97
|
actions
|
98
98
|
end
|
99
99
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_admin/views"
|
2
|
+
require "active_admin/orm/active_record/comments/views/active_admin_comments"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_admin/views"
|
2
|
+
require "active_admin/views/components/panel"
|
3
3
|
|
4
4
|
module ActiveAdmin
|
5
5
|
module Comments
|
@@ -22,13 +22,13 @@ module ActiveAdmin
|
|
22
22
|
protected
|
23
23
|
|
24
24
|
def title
|
25
|
-
I18n.t
|
25
|
+
I18n.t "active_admin.comments.title_content", count: @comments.total_count
|
26
26
|
end
|
27
27
|
|
28
28
|
def build_comments
|
29
29
|
if @comments.any?
|
30
30
|
@comments.each(&method(:build_comment))
|
31
|
-
div page_entries_info(@comments).html_safe, class:
|
31
|
+
div page_entries_info(@comments).html_safe, class: "pagination_information"
|
32
32
|
else
|
33
33
|
build_empty_message
|
34
34
|
end
|
@@ -42,39 +42,39 @@ module ActiveAdmin
|
|
42
42
|
|
43
43
|
def build_comment(comment)
|
44
44
|
div for: comment do
|
45
|
-
div class:
|
46
|
-
h4 class:
|
47
|
-
comment.author ? auto_link(comment.author) : I18n.t(
|
45
|
+
div class: "active_admin_comment_meta" do
|
46
|
+
h4 class: "active_admin_comment_author" do
|
47
|
+
comment.author ? auto_link(comment.author) : I18n.t("active_admin.comments.author_missing")
|
48
48
|
end
|
49
49
|
span pretty_format comment.created_at
|
50
50
|
if authorized?(ActiveAdmin::Auth::DESTROY, comment)
|
51
|
-
text_node link_to I18n.t(
|
51
|
+
text_node link_to I18n.t("active_admin.comments.delete"), comments_url(comment.id), method: :delete, data: { confirm: I18n.t("active_admin.comments.delete_confirmation") }
|
52
52
|
end
|
53
53
|
end
|
54
|
-
div class:
|
54
|
+
div class: "active_admin_comment_body" do
|
55
55
|
simple_format comment.body
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
def build_empty_message
|
61
|
-
span I18n.t(
|
61
|
+
span I18n.t("active_admin.comments.no_comments_yet"), class: "empty"
|
62
62
|
end
|
63
63
|
|
64
64
|
def comments_url(*args)
|
65
65
|
parts = []
|
66
66
|
parts << active_admin_namespace.name unless active_admin_namespace.root?
|
67
67
|
parts << active_admin_namespace.comments_registration_name.underscore
|
68
|
-
parts <<
|
69
|
-
send parts.join(
|
68
|
+
parts << "path"
|
69
|
+
send parts.join("_"), *args
|
70
70
|
end
|
71
71
|
|
72
72
|
def comment_form_url
|
73
73
|
parts = []
|
74
74
|
parts << active_admin_namespace.name unless active_admin_namespace.root?
|
75
75
|
parts << active_admin_namespace.comments_registration_name.underscore.pluralize
|
76
|
-
parts <<
|
77
|
-
send parts.join
|
76
|
+
parts << "path"
|
77
|
+
send parts.join "_"
|
78
78
|
end
|
79
79
|
|
80
80
|
def build_comment_form
|
@@ -82,16 +82,16 @@ module ActiveAdmin
|
|
82
82
|
f.inputs do
|
83
83
|
f.input :resource_type, as: :hidden, input_html: { value: ActiveAdmin::Comment.resource_type(parent.resource) }
|
84
84
|
f.input :resource_id, as: :hidden, input_html: { value: parent.resource.id }
|
85
|
-
f.input :body, label: false, input_html: { size:
|
85
|
+
f.input :body, label: false, input_html: { size: "80x8" }
|
86
86
|
end
|
87
87
|
f.actions do
|
88
|
-
f.action :submit, label: I18n.t(
|
88
|
+
f.action :submit, label: I18n.t("active_admin.comments.add")
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
def default_id_for_prefix
|
94
|
-
|
94
|
+
"active_admin_comments_for"
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
data/lib/active_admin/page.rb
CHANGED
@@ -65,7 +65,7 @@ module ActiveAdmin
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def controller_name
|
68
|
-
[namespace.module_name, camelized_resource_name + "Controller"].compact.join(
|
68
|
+
[namespace.module_name, camelized_resource_name + "Controller"].compact.join("::")
|
69
69
|
end
|
70
70
|
|
71
71
|
# Override from `ActiveAdmin::Resource::Controllers`
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
1
|
+
require "active_admin/resource/action_items"
|
2
|
+
require "active_admin/resource/attributes"
|
3
|
+
require "active_admin/resource/controllers"
|
4
|
+
require "active_admin/resource/menu"
|
5
|
+
require "active_admin/resource/page_presenters"
|
6
|
+
require "active_admin/resource/pagination"
|
7
|
+
require "active_admin/resource/routes"
|
8
|
+
require "active_admin/resource/naming"
|
9
|
+
require "active_admin/resource/scopes"
|
10
|
+
require "active_admin/resource/includes"
|
11
|
+
require "active_admin/resource/scope_to"
|
12
|
+
require "active_admin/resource/sidebars"
|
13
|
+
require "active_admin/resource/belongs_to"
|
14
|
+
require "active_admin/resource/ordering"
|
15
|
+
require "active_admin/resource/model"
|
16
16
|
|
17
17
|
module ActiveAdmin
|
18
18
|
|
@@ -27,7 +27,7 @@ module ActiveAdmin
|
|
27
27
|
class Resource
|
28
28
|
|
29
29
|
# Event dispatched when a new resource is registered
|
30
|
-
RegisterEvent =
|
30
|
+
RegisterEvent = "active_admin.resource.register".freeze
|
31
31
|
|
32
32
|
# The namespace this config belongs to
|
33
33
|
attr_reader :namespace
|
@@ -44,7 +44,7 @@ module ActiveAdmin
|
|
44
44
|
# The default sort order to use in the controller
|
45
45
|
attr_writer :sort_order
|
46
46
|
def sort_order
|
47
|
-
@sort_order ||= (resource_class.respond_to?(:primary_key) ? resource_class.primary_key.to_s :
|
47
|
+
@sort_order ||= (resource_class.respond_to?(:primary_key) ? resource_class.primary_key.to_s : "id") + "_desc"
|
48
48
|
end
|
49
49
|
|
50
50
|
# Set the configuration for the CSV
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "active_admin/helpers/optional_display"
|
2
2
|
|
3
3
|
module ActiveAdmin
|
4
4
|
|
@@ -64,7 +64,7 @@ module ActiveAdmin
|
|
64
64
|
# Adds the default New link on index
|
65
65
|
def add_default_new_action_item
|
66
66
|
add_action_item :new, only: :index do
|
67
|
-
if controller.action_methods.include?(
|
67
|
+
if controller.action_methods.include?("new") && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
|
68
68
|
localizer = ActiveAdmin::Localizers.resource(active_admin_config)
|
69
69
|
link_to localizer.t(:new_model), new_resource_path
|
70
70
|
end
|
@@ -74,7 +74,7 @@ module ActiveAdmin
|
|
74
74
|
# Adds the default Edit link on show
|
75
75
|
def add_default_edit_action_item
|
76
76
|
add_action_item :edit, only: :show do
|
77
|
-
if controller.action_methods.include?(
|
77
|
+
if controller.action_methods.include?("edit") && authorized?(ActiveAdmin::Auth::UPDATE, resource)
|
78
78
|
localizer = ActiveAdmin::Localizers.resource(active_admin_config)
|
79
79
|
link_to localizer.t(:edit_model), edit_resource_path(resource)
|
80
80
|
end
|
@@ -84,7 +84,7 @@ module ActiveAdmin
|
|
84
84
|
# Adds the default Destroy link on show
|
85
85
|
def add_default_show_action_item
|
86
86
|
add_action_item :destroy, only: :show do
|
87
|
-
if controller.action_methods.include?(
|
87
|
+
if controller.action_methods.include?("destroy") && authorized?(ActiveAdmin::Auth::DESTROY, resource)
|
88
88
|
localizer = ActiveAdmin::Localizers.resource(active_admin_config)
|
89
89
|
link_to localizer.t(:delete_model), resource_path(resource), method: :delete,
|
90
90
|
data: { confirm: localizer.t(:delete_confirmation) }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "active_admin/resource"
|
2
2
|
|
3
3
|
module ActiveAdmin
|
4
4
|
class Resource
|
@@ -46,7 +46,7 @@ module ActiveAdmin
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def to_param
|
49
|
-
:"#{@target_name}_id"
|
49
|
+
(@options[:param] || "#{@target_name}_id").to_sym
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -6,7 +6,7 @@ module ActiveAdmin
|
|
6
6
|
# Returns a properly formatted controller name for this
|
7
7
|
# config within its namespace
|
8
8
|
def controller_name
|
9
|
-
[namespace.module_name, resource_name.plural.camelize + "Controller"].compact.join(
|
9
|
+
[namespace.module_name, resource_name.plural.camelize + "Controller"].compact.join("::")
|
10
10
|
end
|
11
11
|
|
12
12
|
# Returns the controller for this config
|
@@ -4,7 +4,7 @@ module ActiveAdmin
|
|
4
4
|
module Naming
|
5
5
|
def resource_name
|
6
6
|
@resource_name ||= begin
|
7
|
-
as = @options[:as].gsub /\s/,
|
7
|
+
as = @options[:as].gsub /\s/, "" if @options[:as]
|
8
8
|
|
9
9
|
if as || !resource_class.respond_to?(:model_name)
|
10
10
|
Name.new resource_class, as
|
@@ -17,7 +17,7 @@ module ActiveAdmin
|
|
17
17
|
# Returns the name to call this resource such as "Bank Account"
|
18
18
|
def resource_label
|
19
19
|
resource_name.translate count: 1,
|
20
|
-
default: resource_name.to_s.gsub(
|
20
|
+
default: resource_name.to_s.gsub("::", " ").titleize
|
21
21
|
end
|
22
22
|
|
23
23
|
# Returns the plural version of this resource such as "Bank Accounts"
|
@@ -104,7 +104,7 @@ module ActiveAdmin
|
|
104
104
|
route << resource_path_name # "posts" or "post"
|
105
105
|
route << suffix # "path" or "index path"
|
106
106
|
|
107
|
-
route.compact.join(
|
107
|
+
route.compact.join("_").to_sym # :admin_category_posts_path
|
108
108
|
end
|
109
109
|
|
110
110
|
# @return params to pass to instance path
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
1
|
+
require "active_admin/collection_decorator"
|
2
|
+
require "active_admin/resource_controller/action_builder"
|
3
|
+
require "active_admin/resource_controller/data_access"
|
4
|
+
require "active_admin/resource_controller/decorators"
|
5
|
+
require "active_admin/resource_controller/polymorphic_routes"
|
6
|
+
require "active_admin/resource_controller/scoping"
|
7
|
+
require "active_admin/resource_controller/streaming"
|
8
|
+
require "active_admin/resource_controller/sidebars"
|
9
|
+
require "active_admin/resource_controller/resource_class_methods"
|
10
10
|
|
11
11
|
module ActiveAdmin
|
12
12
|
# All Resources Controller inherits from this controller.
|
@@ -28,7 +28,7 @@ module ActiveAdmin
|
|
28
28
|
|
29
29
|
def decorate?
|
30
30
|
case action_name
|
31
|
-
when
|
31
|
+
when "new", "edit", "create", "update"
|
32
32
|
form = active_admin_config.get_page_presenter :form
|
33
33
|
form && form.options[:decorate] && decorator_class.present?
|
34
34
|
else
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "csv"
|
2
2
|
|
3
3
|
module ActiveAdmin
|
4
4
|
class ResourceController < BaseController
|
@@ -18,11 +18,12 @@ module ActiveAdmin
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def stream_resource(&block)
|
21
|
-
headers[
|
22
|
-
headers[
|
21
|
+
headers["X-Accel-Buffering"] = "no"
|
22
|
+
headers["Cache-Control"] = "no-cache"
|
23
|
+
headers["Last-Modified"] = Time.current.httpdate
|
23
24
|
|
24
25
|
if ActiveAdmin.application.disable_streaming_in.include? Rails.env
|
25
|
-
self.response_body = block[
|
26
|
+
self.response_body = block[""]
|
26
27
|
else
|
27
28
|
self.response_body = Enumerator.new &block
|
28
29
|
end
|
@@ -33,8 +34,8 @@ module ActiveAdmin
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def stream_csv
|
36
|
-
headers[
|
37
|
-
headers[
|
37
|
+
headers["Content-Type"] = "text/csv; charset=utf-8" # In Rails 5 it's set to HTML??
|
38
|
+
headers["Content-Disposition"] = %{attachment; filename="#{csv_filename}"}
|
38
39
|
stream_resource &active_admin_config.csv_builder.method(:build).to_proc.curry[self]
|
39
40
|
end
|
40
41
|
|
data/lib/active_admin/scope.rb
CHANGED
@@ -55,7 +55,7 @@ module ActiveAdmin
|
|
55
55
|
def name
|
56
56
|
case @name
|
57
57
|
when String then @name
|
58
|
-
when Symbol then @localizer ? @localizer.t(@name, scope:
|
58
|
+
when Symbol then @localizer ? @localizer.t(@name, scope: "scopes") : @name.to_s.titleize
|
59
59
|
else @name
|
60
60
|
end
|
61
61
|
end
|
data/lib/active_admin/version.rb
CHANGED
@@ -2,7 +2,7 @@ module ActiveAdmin
|
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
4
|
# Require all ruby files in the view helpers dir
|
5
|
-
Dir[File.expand_path(
|
5
|
+
Dir[File.expand_path("view_helpers", __dir__) + "/*.rb"].each { |f| require f }
|
6
6
|
|
7
7
|
include ActiveAdminApplicationHelper
|
8
8
|
include AutoLinkHelper
|
@@ -6,7 +6,7 @@ module ActiveAdmin
|
|
6
6
|
def breadcrumb_links(path = request.path)
|
7
7
|
# remove leading "/" and split up the URL
|
8
8
|
# and remove last since it's used as the page title
|
9
|
-
parts = path.split(
|
9
|
+
parts = path.split("/").select(&:present?)[0..-2]
|
10
10
|
|
11
11
|
parts.each_with_index.map do |part, index|
|
12
12
|
# 1. try using `display_name` if we can locate a DB object
|
@@ -21,7 +21,7 @@ module ActiveAdmin
|
|
21
21
|
|
22
22
|
# Don't create a link if the resource's show action is disabled
|
23
23
|
if !config || config.defined_actions.include?(:show)
|
24
|
-
link_to name,
|
24
|
+
link_to name, "/" + parts[0..index].join("/")
|
25
25
|
else
|
26
26
|
name
|
27
27
|
end
|