activeadmin 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/CONTRIBUTING.md +6 -6
- data/README.md +3 -3
- data/app/assets/javascripts/active_admin/base.js +1 -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/docs/5-forms.md +6 -1
- data/docs/6-show-pages.md +12 -0
- data/docs/Gemfile +2 -2
- data/docs/Gemfile.lock +23 -22
- data/lib/active_admin/application.rb +8 -8
- data/lib/active_admin/application_settings.rb +3 -3
- data/lib/active_admin/base_controller/authorization.rb +4 -3
- data/lib/active_admin/base_controller.rb +4 -4
- 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 +10 -8
- data/lib/active_admin/error.rb +0 -2
- data/lib/active_admin/filters/active.rb +1 -1
- data/lib/active_admin/filters/active_filter.rb +5 -6
- 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/filters.rb +6 -6
- data/lib/active_admin/form_builder.rb +21 -17
- 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/search_method_select.rb +2 -2
- data/lib/active_admin/inputs/filters/base.rb +1 -1
- 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/resource_localizer.rb +3 -3
- data/lib/active_admin/localizers.rb +1 -1
- 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/comments/views/active_admin_comments.rb +17 -17
- data/lib/active_admin/orm/active_record/comments/views.rb +2 -2
- data/lib/active_admin/orm/active_record/comments.rb +13 -13
- data/lib/active_admin/orm/active_record.rb +1 -1
- data/lib/active_admin/page.rb +1 -1
- data/lib/active_admin/pundit_adapter.rb +1 -1
- 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 -3
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource.rb +17 -17
- data/lib/active_admin/resource_controller/decorators.rb +1 -3
- data/lib/active_admin/resource_controller/streaming.rb +7 -6
- data/lib/active_admin/resource_controller.rb +9 -9
- 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/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/view_helpers.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/active_admin/views.rb +1 -1
- data/lib/active_admin.rb +55 -56
- 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 +5 -39
|
@@ -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
|
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,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"
|
|
@@ -42,8 +42,6 @@ module ActiveAdmin
|
|
|
42
42
|
config[:route_collection_name] == config[:route_instance_name]
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
private
|
|
46
|
-
|
|
47
45
|
class RouteBuilder
|
|
48
46
|
def initialize(resource)
|
|
49
47
|
@resource = resource
|
|
@@ -104,7 +102,7 @@ module ActiveAdmin
|
|
|
104
102
|
route << resource_path_name # "posts" or "post"
|
|
105
103
|
route << suffix # "path" or "index path"
|
|
106
104
|
|
|
107
|
-
route.compact.join(
|
|
105
|
+
route.compact.join("_").to_sym # :admin_category_posts_path
|
|
108
106
|
end
|
|
109
107
|
|
|
110
108
|
# @return params to pass to instance path
|
|
@@ -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
|
|
@@ -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
|
|
@@ -57,8 +57,6 @@ module ActiveAdmin
|
|
|
57
57
|
@cache[name] ||= wrap! collection_decorator, name
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
private
|
|
61
|
-
|
|
62
60
|
def self.wrap!(parent, name)
|
|
63
61
|
::Class.new parent do
|
|
64
62
|
delegate :reorder, :page, :current_page, :total_pages, :limit_value,
|
|
@@ -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
|
|
|
@@ -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.
|
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
|
@@ -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
|
|
@@ -10,7 +10,7 @@ module ActiveAdmin
|
|
|
10
10
|
name.present? ? name : to_s
|
|
11
11
|
}
|
|
12
12
|
def DISPLAY_NAME_FALLBACK.inspect
|
|
13
|
-
|
|
13
|
+
"DISPLAY_NAME_FALLBACK"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Attempts to call any known display name methods on the resource.
|
|
@@ -85,7 +85,7 @@ module ActiveAdmin
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def format_collection(collection)
|
|
88
|
-
safe_join(collection.map { |item| pretty_format(item) },
|
|
88
|
+
safe_join(collection.map { |item| pretty_format(item) }, ", ")
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def boolean_attr?(resource, attr, value)
|
|
@@ -18,7 +18,7 @@ module ActiveAdmin
|
|
|
18
18
|
def build_download_format_links(formats = self.class.formats)
|
|
19
19
|
params = request.query_parameters.except :format, :commit
|
|
20
20
|
div class: "download_links" do
|
|
21
|
-
span I18n.t(
|
|
21
|
+
span I18n.t("active_admin.download")
|
|
22
22
|
formats.each do |format|
|
|
23
23
|
a format.upcase, href: url_for(params: params, format: format)
|
|
24
24
|
end
|
|
@@ -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
|
|
@@ -111,14 +111,14 @@ module ActiveAdmin
|
|
|
111
111
|
create_another = params[:create_another]
|
|
112
112
|
label = @resource.class.model_name.human
|
|
113
113
|
Arbre::Context.new do
|
|
114
|
-
li class:
|
|
114
|
+
li class: "create_another" do
|
|
115
115
|
input(
|
|
116
116
|
checked: create_another,
|
|
117
|
-
id:
|
|
118
|
-
name:
|
|
119
|
-
type:
|
|
117
|
+
id: "create_another",
|
|
118
|
+
name: "create_another",
|
|
119
|
+
type: "checkbox"
|
|
120
120
|
)
|
|
121
|
-
label(I18n.t(
|
|
121
|
+
label(I18n.t("active_admin.create_another", model: label), for: "create_another")
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -28,7 +28,7 @@ module ActiveAdmin
|
|
|
28
28
|
elsif title.present?
|
|
29
29
|
classes << "row-#{title.to_s.parameterize(separator: "_")}"
|
|
30
30
|
end
|
|
31
|
-
options[:class] = classes.join(
|
|
31
|
+
options[:class] = classes.join(" ")
|
|
32
32
|
|
|
33
33
|
@table << tr(options) do
|
|
34
34
|
th do
|
|
@@ -45,7 +45,7 @@ module ActiveAdmin
|
|
|
45
45
|
protected
|
|
46
46
|
|
|
47
47
|
def default_id_for_prefix
|
|
48
|
-
|
|
48
|
+
"attributes_table"
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Build Colgroups
|
|
@@ -75,7 +75,7 @@ module ActiveAdmin
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def empty_value
|
|
78
|
-
span I18n.t(
|
|
78
|
+
span I18n.t("active_admin.empty"), class: "empty"
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def content_for(record, attr)
|
|
@@ -44,21 +44,21 @@ module ActiveAdmin
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
46
|
def build_button(name, button_options)
|
|
47
|
-
button_options[:class] ||=
|
|
48
|
-
button_options[:class] <<
|
|
47
|
+
button_options[:class] ||= ""
|
|
48
|
+
button_options[:class] << " dropdown_menu_button"
|
|
49
49
|
|
|
50
|
-
button_options[:href] =
|
|
50
|
+
button_options[:href] = "#"
|
|
51
51
|
|
|
52
52
|
a name, button_options
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def build_menu(options)
|
|
56
|
-
options[:class] ||=
|
|
57
|
-
options[:class] <<
|
|
56
|
+
options[:class] ||= ""
|
|
57
|
+
options[:class] << " dropdown_menu_list"
|
|
58
58
|
|
|
59
59
|
menu_list = nil
|
|
60
60
|
|
|
61
|
-
div class:
|
|
61
|
+
div class: "dropdown_menu_list_wrapper" do
|
|
62
62
|
menu_list = ul(options)
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "active_admin/helpers/collection"
|
|
2
2
|
|
|
3
3
|
module ActiveAdmin
|
|
4
4
|
module Views
|
|
@@ -15,7 +15,7 @@ module ActiveAdmin
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def tag_name
|
|
18
|
-
|
|
18
|
+
"ul"
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# Builds the links for presenting different index views to the user
|
|
@@ -30,7 +30,7 @@ module ActiveAdmin
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def tag_name
|
|
33
|
-
|
|
33
|
+
"li"
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Sorts by priority first, then alphabetically by label if needed.
|
|
@@ -44,14 +44,14 @@ module ActiveAdmin
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def to_s
|
|
47
|
-
visible? ? super :
|
|
47
|
+
visible? ? super : ""
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
private
|
|
51
51
|
|
|
52
52
|
# URL is not nil, empty, or '#'
|
|
53
53
|
def real_url?
|
|
54
|
-
url && url.present? && url !=
|
|
54
|
+
url && url.present? && url != "#"
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "active_admin/helpers/collection"
|
|
2
|
+
require "active_admin/view_helpers/download_format_links_helper"
|
|
3
3
|
|
|
4
4
|
module ActiveAdmin
|
|
5
5
|
module Views
|
|
@@ -92,7 +92,7 @@ module ActiveAdmin
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def build_pagination
|
|
95
|
-
options = { theme: @display_total ?
|
|
95
|
+
options = { theme: @display_total ? "active_admin" : "active_admin_countless" }
|
|
96
96
|
options[:params] = @params if @params
|
|
97
97
|
options[:param_name] = @param_name if @param_name
|
|
98
98
|
|
|
@@ -119,12 +119,12 @@ module ActiveAdmin
|
|
|
119
119
|
entry_name = options[:entry_name]
|
|
120
120
|
entries_name = options[:entries_name] || entry_name.pluralize
|
|
121
121
|
elsif collection_is_empty?
|
|
122
|
-
entry_name = I18n.t "active_admin.pagination.entry", count: 1, default:
|
|
123
|
-
entries_name = I18n.t "active_admin.pagination.entry", count: 2, default:
|
|
122
|
+
entry_name = I18n.t "active_admin.pagination.entry", count: 1, default: "entry"
|
|
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
|
+
entry_name = I18n.translate key, count: 1, default: collection.first.class.name.underscore.sub("_", " ")
|
|
128
128
|
entries_name = I18n.translate key, count: collection.size, default: entry_name.pluralize
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "active_admin/helpers/collection"
|
|
2
|
+
require "active_admin/view_helpers/method_or_proc_helper"
|
|
3
3
|
|
|
4
4
|
module ActiveAdmin
|
|
5
5
|
module Views
|
|
@@ -17,7 +17,7 @@ module ActiveAdmin
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def tag_name
|
|
20
|
-
|
|
20
|
+
"div"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def build(scopes, options = {})
|
|
@@ -38,9 +38,9 @@ module ActiveAdmin
|
|
|
38
38
|
li class: classes_for_scope(scope) do
|
|
39
39
|
params = request.query_parameters.except :page, :scope, :commit, :format
|
|
40
40
|
|
|
41
|
-
a href: url_for(scope: scope.id, params: params), class:
|
|
41
|
+
a href: url_for(scope: scope.id, params: params), class: "table_tools_button" do
|
|
42
42
|
text_node scope_name(scope)
|
|
43
|
-
span class:
|
|
43
|
+
span class: "count" do
|
|
44
44
|
"(#{get_scope_count(scope)})"
|
|
45
45
|
end if options[:scope_count] && scope.show_count
|
|
46
46
|
end
|