activeadmin 4.0.0.beta22 → 4.0.0.beta23
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/CONTRIBUTING.md +1 -1
- data/UPGRADING.md +2 -2
- data/app/controllers/active_admin/resource_controller/data_access.rb +9 -0
- data/app/helpers/active_admin/layout_helper.rb +1 -1
- data/app/views/active_admin/shared/_resource_comments.html.erb +1 -1
- data/config/locales/ca.yml +5 -0
- data/config/locales/vi.yml +9 -0
- data/lib/active_admin/filters/active.rb +2 -1
- data/lib/active_admin/filters/formtastic_addons.rb +8 -2
- data/lib/active_admin/inputs/filters/string_input.rb +16 -0
- data/lib/active_admin/namespace_settings.rb +4 -0
- data/lib/active_admin/orm/active_record/comments.rb +5 -6
- data/lib/active_admin/resource/attributes.rb +2 -0
- data/lib/active_admin/resource.rb +5 -0
- data/lib/active_admin/resource_dsl.rb +13 -0
- data/lib/active_admin/router.rb +1 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/views/components/table_for.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5ff3812d441118e4a89c7887afa6f28f05e9be1b3b18d72ab0376cb2596648ce
|
|
4
|
+
data.tar.gz: 62cc70430def6ca312094b532c2323bc8b42642de5ef92e3080045ec3f10218f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33178626e15d37898ddeceba1f9ccfbe3e1ef0150de13db00c115923ff2e81d9cfc4c18e1ec8034b5c643113055da1d970d995be305945f453c43674adff3800
|
|
7
|
+
data.tar.gz: 9506486af9a082f203de1f124389a1113f4b967cbb8210ccb076f65cb141ba9fe078c221226a9d20ec165288bdf0cfeb570da223130342be6dcd011c3d0722d3
|
data/CONTRIBUTING.md
CHANGED
data/UPGRADING.md
CHANGED
|
@@ -7,14 +7,14 @@ ActiveAdmin v4 uses Tailwind CSS v4. It has **mobile web, dark mode and RTL supp
|
|
|
7
7
|
|
|
8
8
|
These instructions assume the `cssbundling-rails` and `importmap-rails` gems are already installed and you have run their install commands in your app. If you haven't done so, please do before continuing.
|
|
9
9
|
|
|
10
|
-
Update your `Gemfile` with `gem "activeadmin", "4.0.0.
|
|
10
|
+
Update your `Gemfile` with `gem "activeadmin", "4.0.0.beta23"` and then run `gem install activeadmin --pre`.
|
|
11
11
|
|
|
12
12
|
Now, run `rails generate active_admin:assets` to replace the old assets with the new files.
|
|
13
13
|
|
|
14
14
|
Then add the npm package and update the `build:css` script.
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
|
|
17
|
+
npm install @activeadmin/activeadmin@4.0.0-beta23
|
|
18
18
|
npm pkg set scripts.build:css="npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify"
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -75,6 +75,15 @@ module ActiveAdmin
|
|
|
75
75
|
end_of_association_chain
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# Derive the parent's `has_many` association name from the
|
|
79
|
+
# resource's model class so that resources registered with an
|
|
80
|
+
# `as:` alias still scope through the correct collection.
|
|
81
|
+
def method_for_association_chain
|
|
82
|
+
return super unless active_admin_config&.belongs_to?
|
|
83
|
+
|
|
84
|
+
active_admin_config.resource_class.model_name.element.pluralize.to_sym
|
|
85
|
+
end
|
|
86
|
+
|
|
78
87
|
# Retrieve, memoize and authorize a resource based on params[:id]. The
|
|
79
88
|
# actual work of finding the resource is done in #find_resource.
|
|
80
89
|
#
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<%= simple_format(comment.body) %>
|
|
34
34
|
</div>
|
|
35
35
|
<% if authorized?(ActiveAdmin::Auth::DESTROY, comment) %>
|
|
36
|
-
<%= link_to I18n.t("active_admin.comments.delete"), url_for_comments(comment.id), method: :delete, data: { confirm: I18n.t("active_admin.comments.delete_confirmation") } %>
|
|
36
|
+
<%= link_to I18n.t("active_admin.comments.delete"), url_for_comments(comment.id, return_to: "back"), method: :delete, data: { confirm: I18n.t("active_admin.comments.delete_confirmation") } %>
|
|
37
37
|
<% end %>
|
|
38
38
|
</div>
|
|
39
39
|
<% end %>
|
data/config/locales/ca.yml
CHANGED
|
@@ -109,6 +109,7 @@ ca:
|
|
|
109
109
|
one_page: S'estan mostrant <b>tots %{n}</b>
|
|
110
110
|
per_page: Per pàgina
|
|
111
111
|
previous: Anterior
|
|
112
|
+
truncate: "…"
|
|
112
113
|
powered_by: Powered by %{active_admin} %{version}
|
|
113
114
|
previous: Anterior
|
|
114
115
|
scopes:
|
|
@@ -124,6 +125,10 @@ ca:
|
|
|
124
125
|
'no': 'No'
|
|
125
126
|
unset: Desconegut
|
|
126
127
|
'yes': Sí
|
|
128
|
+
toggle_dark_mode: Activar el modus fosc
|
|
129
|
+
toggle_main_navigation_menu: Activar el menú principal de navegació
|
|
130
|
+
toggle_section: Activar la secció
|
|
131
|
+
toggle_user_menu: Activar el menú d'usuari
|
|
127
132
|
view: Mostra
|
|
128
133
|
activerecord:
|
|
129
134
|
attributes:
|
data/config/locales/vi.yml
CHANGED
|
@@ -104,15 +104,20 @@ vi:
|
|
|
104
104
|
other: entries
|
|
105
105
|
multiple: Đang hiển thị %{model} <b>%{from} - %{to}</b> of <b>%{total}</b> trong tất cả.
|
|
106
106
|
multiple_without_total: Đang hiển thị %{model} <b>%{from} - %{to}</b>.
|
|
107
|
+
next: Tiếp
|
|
107
108
|
one: Đang hiển thị <b>1</b> %{model}
|
|
108
109
|
one_page: Đang hiển thị <b>tất cả %{n}</b> %{model}
|
|
109
110
|
per_page: 'Mỗi trang: '
|
|
111
|
+
previous: Trước
|
|
112
|
+
truncate: "…"
|
|
110
113
|
powered_by: Bản quyền bởi %{active_admin} %{version}
|
|
111
114
|
previous: Trước
|
|
112
115
|
scopes:
|
|
113
116
|
all: Tất cả
|
|
114
117
|
search_status:
|
|
115
118
|
no_current_filters: Không có
|
|
119
|
+
title: Bộ lọc hiện tại
|
|
120
|
+
title_with_scope: Đang tìm kiếm theo %{name}
|
|
116
121
|
sidebars:
|
|
117
122
|
filters: Bộ Lọc
|
|
118
123
|
search_status: Trạng thái tìm kiếm
|
|
@@ -120,6 +125,10 @@ vi:
|
|
|
120
125
|
'no': Không Có
|
|
121
126
|
unset: Không Có
|
|
122
127
|
'yes': Có
|
|
128
|
+
toggle_dark_mode: Bật/tắt chế độ tối
|
|
129
|
+
toggle_main_navigation_menu: Bật/tắt menu điều hướng chính
|
|
130
|
+
toggle_section: Phần chuyển đổi
|
|
131
|
+
toggle_user_menu: Bật/tắt menu người dùng
|
|
123
132
|
view: Xem
|
|
124
133
|
activerecord:
|
|
125
134
|
attributes:
|
|
@@ -14,7 +14,8 @@ module ActiveAdmin
|
|
|
14
14
|
# @see ActiveAdmin::ResourceController::DataAccess#apply_filtering
|
|
15
15
|
def initialize(resource, search)
|
|
16
16
|
@resource = resource
|
|
17
|
-
|
|
17
|
+
# Ransack::Search uses method_missing for #conditions, so gate on the class.
|
|
18
|
+
@filters = search.is_a?(::Ransack::Search) ? build_filters(search.conditions) : []
|
|
18
19
|
@scopes = search.instance_variable_get(:@scope_args)
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -32,12 +32,14 @@ module ActiveAdmin
|
|
|
32
32
|
# The below are custom methods that Formtastic does not provide.
|
|
33
33
|
#
|
|
34
34
|
|
|
35
|
-
# The resource class, unwrapped from Ransack
|
|
35
|
+
# The resource class, unwrapped from Ransack or `nil` for non-Ransack search objects.
|
|
36
36
|
def klass
|
|
37
|
-
@object.object.klass
|
|
37
|
+
@object.object.klass if @object.respond_to?(:object) && @object.object.respond_to?(:klass)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def polymorphic_foreign_type?(method)
|
|
41
|
+
return false if klass.nil?
|
|
42
|
+
|
|
41
43
|
klass.reflect_on_all_associations.select { |r| r.macro == :belongs_to && r.options[:polymorphic] }
|
|
42
44
|
.map(&:foreign_type).include? method.to_s
|
|
43
45
|
end
|
|
@@ -47,6 +49,8 @@ module ActiveAdmin
|
|
|
47
49
|
#
|
|
48
50
|
|
|
49
51
|
def searchable_has_many_through?
|
|
52
|
+
return false if klass.nil?
|
|
53
|
+
|
|
50
54
|
if klass.ransackable_associations.include?(method.to_s) && reflection && reflection.options[:through]
|
|
51
55
|
reflection.through_reflection.klass.ransackable_attributes.include? reflection.foreign_key
|
|
52
56
|
else
|
|
@@ -66,6 +70,8 @@ module ActiveAdmin
|
|
|
66
70
|
|
|
67
71
|
# Ransack supports exposing selected scopes on your model for advanced searches.
|
|
68
72
|
def scope?
|
|
73
|
+
return false if klass.nil?
|
|
74
|
+
|
|
69
75
|
context = Ransack::Context.for klass
|
|
70
76
|
context.respond_to?(:ransackable_scope?) && context.ransackable_scope?(method.to_s, klass)
|
|
71
77
|
end
|
|
@@ -21,6 +21,22 @@ module ActiveAdmin
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def filters
|
|
25
|
+
options[:filters] || resource_default_filters || namespace_default_filters || self.class.filters
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def resource_default_filters
|
|
31
|
+
config = template.active_admin_config if template.respond_to?(:active_admin_config)
|
|
32
|
+
config.string_input_filters if config.respond_to?(:string_input_filters)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def namespace_default_filters
|
|
36
|
+
template.respond_to?(:active_admin_config) &&
|
|
37
|
+
template.active_admin_config&.namespace&.string_input_filters
|
|
38
|
+
end
|
|
39
|
+
|
|
24
40
|
end
|
|
25
41
|
end
|
|
26
42
|
end
|
|
@@ -29,6 +29,10 @@ module ActiveAdmin
|
|
|
29
29
|
# Whether filters are enabled
|
|
30
30
|
register :filters, true
|
|
31
31
|
|
|
32
|
+
# Default `filters` list for string filters in the namespace.
|
|
33
|
+
# When `nil`, the global `ActiveAdmin::Inputs::Filters::StringInput.filters` list is used.
|
|
34
|
+
register :string_input_filters, nil
|
|
35
|
+
|
|
32
36
|
# The namespace root
|
|
33
37
|
register :root_to, "dashboard#index"
|
|
34
38
|
|
|
@@ -75,12 +75,11 @@ ActiveAdmin.after_load do |app|
|
|
|
75
75
|
def destroy
|
|
76
76
|
destroy! do |success, failure|
|
|
77
77
|
success.html do
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
redirect_back fallback_location: active_admin_root
|
|
78
|
+
if params[:return_to] == "back"
|
|
79
|
+
redirect_back fallback_location: active_admin_root
|
|
80
|
+
else
|
|
81
|
+
redirect_to action: :index
|
|
82
|
+
end
|
|
84
83
|
end
|
|
85
84
|
failure.html do
|
|
86
85
|
redirect_back fallback_location: active_admin_root
|
|
@@ -68,6 +68,11 @@ module ActiveAdmin
|
|
|
68
68
|
# nil to not decorate.
|
|
69
69
|
attr_accessor :decorator_class_name
|
|
70
70
|
|
|
71
|
+
# Default `filters` list for string filters on this resource. Takes
|
|
72
|
+
# priority over the namespace-level `string_input_filters` setting when
|
|
73
|
+
# set; when nil, falls back to it, and then to the global default.
|
|
74
|
+
attr_accessor :string_input_filters
|
|
75
|
+
|
|
71
76
|
module Base
|
|
72
77
|
def initialize(namespace, resource_class, options = {})
|
|
73
78
|
@namespace = namespace
|
|
@@ -154,6 +154,19 @@ module ActiveAdmin
|
|
|
154
154
|
action config.collection_actions, name, options, &block
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
+
# Set the default `filters` list for this resource's string filters.
|
|
158
|
+
# Takes priority over the namespace-level `string_input_filters` setting.
|
|
159
|
+
#
|
|
160
|
+
# For example:
|
|
161
|
+
#
|
|
162
|
+
# ActiveAdmin.register Post do
|
|
163
|
+
# string_input_filters [:eq, :cont]
|
|
164
|
+
# end
|
|
165
|
+
#
|
|
166
|
+
def string_input_filters(value)
|
|
167
|
+
config.string_input_filters = value
|
|
168
|
+
end
|
|
169
|
+
|
|
157
170
|
def decorate_with(decorator_class)
|
|
158
171
|
# Force storage as a string. This will help us with reloading issues.
|
|
159
172
|
# Assuming decorator_class.to_s will return the name of the class allows
|
data/lib/active_admin/router.rb
CHANGED
|
@@ -68,7 +68,7 @@ module ActiveAdmin
|
|
|
68
68
|
router.get "/#{page}", to: "#{page}#index"
|
|
69
69
|
config.page_actions.each do |action|
|
|
70
70
|
Array.wrap(action.http_verb).each do |verb|
|
|
71
|
-
build_route(verb, "/#{page}/#{action.name}"
|
|
71
|
+
build_route(verb, "/#{page}/#{action.name}", to: "#{page}##{action.name}")
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
data/lib/active_admin/version.rb
CHANGED
|
@@ -83,9 +83,9 @@ module ActiveAdmin
|
|
|
83
83
|
if sort_key
|
|
84
84
|
th(attributes) do
|
|
85
85
|
link_to params: params, order: "#{sort_key}_#{order_for_sort_key(sort_key)}" do
|
|
86
|
-
svg = '<svg class="data-table-sorted-icon" fill="none" viewBox="0 0 10 6"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/></svg>'
|
|
86
|
+
svg = '<svg class="data-table-sorted-icon" fill="none" viewBox="0 0 10 6"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/></svg>'.html_safe
|
|
87
87
|
|
|
88
|
-
(col.pretty_title
|
|
88
|
+
safe_join([col.pretty_title, svg])
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
else
|
|
@@ -160,7 +160,7 @@ module ActiveAdmin
|
|
|
160
160
|
def sortable?
|
|
161
161
|
if @options.has_key?(:sortable)
|
|
162
162
|
!!@options[:sortable]
|
|
163
|
-
elsif @resource_class
|
|
163
|
+
elsif @resource_class.respond_to?(:column_names)
|
|
164
164
|
@resource_class.column_names.include?(sort_column_name)
|
|
165
165
|
else
|
|
166
166
|
@title.present?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activeadmin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.0.
|
|
4
|
+
version: 4.0.0.beta23
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charles Maresh
|
|
@@ -396,14 +396,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
396
396
|
requirements:
|
|
397
397
|
- - ">="
|
|
398
398
|
- !ruby/object:Gem::Version
|
|
399
|
-
version: '3.
|
|
399
|
+
version: '3.3'
|
|
400
400
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
401
|
requirements:
|
|
402
402
|
- - ">="
|
|
403
403
|
- !ruby/object:Gem::Version
|
|
404
404
|
version: '0'
|
|
405
405
|
requirements: []
|
|
406
|
-
rubygems_version: 4.0.
|
|
406
|
+
rubygems_version: 4.0.20
|
|
407
407
|
specification_version: 4
|
|
408
408
|
summary: Active Admin is a Ruby on Rails plugin for generating administration style
|
|
409
409
|
interfaces. It abstracts common business application patterns to make it simple
|