activeadmin 4.0.0.beta19 → 4.0.0.beta20
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 +4 -0
- data/UPGRADING.md +3 -3
- data/app/controllers/active_admin/base_controller/menu.rb +2 -2
- data/app/javascript/active_admin/features/main_menu.js +3 -2
- data/app/views/active_admin/_main_navigation.html.erb +27 -10
- data/app/views/active_admin/shared/_resource_comments.html.erb +3 -3
- data/lib/active_admin/async_count.rb +1 -3
- data/lib/active_admin/menu.rb +2 -2
- data/lib/active_admin/resource.rb +1 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/generators/active_admin/assets/templates/tailwind.config.js +2 -1
- data/plugin.js +10 -6
- 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: 15f9525d6a02bc6ebaef19b65cd6a455ac13349659993bbc7bd4ca2b078015a9
|
|
4
|
+
data.tar.gz: 405bc3808117da8f1111eb80fc0b67fed6d7f251b0e1fae0bf45731c69f87638
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 769deda0cc56d1fdf0d4d50d8a8fb29952eb23c04fd7539f17cbf7538b8b22e2e5f6fd701fcbf82a341cc941d7ffc0c646a05878bebd462058fd7a16161ab2b8
|
|
7
|
+
data.tar.gz: db187d391063e6628600d0eb26cb7f9e6d0ae42c08ee2340655905eeee02485ba7aa1afb2e99f532435544a1afa3ed85cc974425ff09c55be60e7921db970d55
|
data/CONTRIBUTING.md
CHANGED
|
@@ -84,6 +84,10 @@ At this point, if your changes look good and tests are passing, you are ready to
|
|
|
84
84
|
Github Actions will run our test suite against all supported Rails versions. It's possible that your changes pass tests in one Rails version but fail in another. In that case, you'll have to setup your development
|
|
85
85
|
environment with the Gemfile for the problematic Rails version, and investigate what's going on.
|
|
86
86
|
|
|
87
|
+
## Commit messages
|
|
88
|
+
|
|
89
|
+
Try your best to follow these [seven rules for a great commit message](https://cbea.ms/git-commit/#seven-rules).
|
|
90
|
+
|
|
87
91
|
## Merging a PR (maintainers only)
|
|
88
92
|
|
|
89
93
|
A PR can only be merged into master by a maintainer if: CI is passing, approved by another maintainer and is up to date with the default branch. Any maintainer is allowed to merge a PR if all of these conditions ae met.
|
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.beta20"` 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
|
-
yarn add @activeadmin/activeadmin@4.0.0-
|
|
17
|
+
yarn add @activeadmin/activeadmin@4.0.0-beta20
|
|
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
|
|
|
@@ -46,7 +46,7 @@ Note that the templates can and will change across releases. There are additiona
|
|
|
46
46
|
|
|
47
47
|
With the setup complete, please review the Breaking Changes section and resolve any that may or may not impact your integration.
|
|
48
48
|
|
|
49
|
-
### Upgrading from earlier 4.x beta
|
|
49
|
+
### Upgrading from an earlier 4.x beta release
|
|
50
50
|
|
|
51
51
|
When upgrading from any earlier 4.0.0 beta release, please apply the changes outlined below.
|
|
52
52
|
|
|
@@ -17,8 +17,8 @@ module ActiveAdmin
|
|
|
17
17
|
active_admin_config.navigation_menu
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def current_menu_item?(item)
|
|
21
|
-
item.current?(@current_menu_item)
|
|
20
|
+
def current_menu_item?(item, children: true)
|
|
21
|
+
item.current?(@current_menu_item, children: children)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def set_current_menu_item
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Rails from '@rails/ujs';
|
|
2
2
|
|
|
3
|
-
const toggleMenu = function(
|
|
4
|
-
const parent = this.parentNode
|
|
3
|
+
const toggleMenu = function() {
|
|
4
|
+
const parent = this.closest([`[data-item-id="${this.dataset.parentId}"]`]) || this.parentNode
|
|
5
|
+
|
|
5
6
|
if (!("open" in parent.dataset)) {
|
|
6
7
|
parent.dataset.open = ""
|
|
7
8
|
} else {
|
|
@@ -2,25 +2,42 @@
|
|
|
2
2
|
<ul role="list" class="flex flex-1 flex-col space-y-1.5">
|
|
3
3
|
<% current_menu.items(self).each do |item| %>
|
|
4
4
|
<% children = item.items(self).presence %>
|
|
5
|
+
<% url = item.url(self) %>
|
|
6
|
+
<% label = capture do %>
|
|
7
|
+
<% if url.present? %>
|
|
8
|
+
<%= link_to item.label(self), url, item.html_options.merge(class: "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center w-full rounded-md p-2 gap-x-2 text-sm no-underline #{(current_menu_item?(item, children: false) ? "bg-gray-100 dark:bg-white/5 text-gray-900 dark:text-white selected" : "")}") %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= item.label(self) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
5
13
|
<li <%= current_menu_item?(item) && "data-open" %> class="group" data-item-id="<%= item.id %>">
|
|
6
14
|
<% if children %>
|
|
7
|
-
|
|
8
|
-
<%=
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
<% if url.present? && url == "#" %>
|
|
16
|
+
<button data-menu-button class="text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center w-full rounded-md p-2 gap-x-2 text-sm" aria-label="<%= t('active_admin.toggle_section') %>">
|
|
17
|
+
<%= item.label(self) %>
|
|
18
|
+
<svg class="group-data-open:rotate-90 group-data-open:rtl:-rotate-90 ms-auto h-5 w-5 shrink-0 rtl:-scale-x-100" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
19
|
+
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
|
|
20
|
+
</svg>
|
|
21
|
+
</button>
|
|
22
|
+
<% elsif url.present? && url != "#" %>
|
|
23
|
+
<div data-parent-id="<%= item.id %>" data-menu-button class="flex">
|
|
24
|
+
<%= label %>
|
|
25
|
+
<button class="text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center p-2 text-sm" aria-label="<%= t('active_admin.toggle_section') %>">
|
|
26
|
+
<svg class="group-data-open:rotate-90 group-data-open:rtl:-rotate-90 ms-auto h-5 w-5 shrink-0 rtl:-scale-x-100" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
27
|
+
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
|
|
28
|
+
</svg>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
<% end %>
|
|
32
|
+
<ul role="list" class="mt-1 space-y-1 hidden group-data-open:block ms-1 ps-2 border-s-2 border-gray-100 dark:border-white/5">
|
|
14
33
|
<% children.each do |j| %>
|
|
15
34
|
<li data-item-id="<%= j.id %>">
|
|
16
35
|
<%= link_to j.label(self), j.url(self), j.html_options.merge(class: "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white block rounded-md py-1.5 px-2 text-sm no-underline #{(current_menu_item?(j) ? "bg-gray-100 dark:bg-white/5 text-gray-900 dark:text-white selected" : "")}") %>
|
|
17
36
|
</li>
|
|
18
37
|
<% end %>
|
|
19
38
|
</ul>
|
|
20
|
-
<% elsif url = item.url(self) %>
|
|
21
|
-
<%= link_to item.label(self), url, item.html_options.merge(class: "text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white flex items-center w-full rounded-md p-2 gap-x-2 text-sm no-underline #{(current_menu_item?(item) ? "bg-gray-100 dark:bg-white/5 text-gray-900 dark:text-white selected" : "")}") %>
|
|
22
39
|
<% else %>
|
|
23
|
-
<%=
|
|
40
|
+
<%= label %>
|
|
24
41
|
<% end %>
|
|
25
42
|
</li>
|
|
26
43
|
<% end %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="max-w-[700px]">
|
|
1
|
+
<div id="active-admin-comments-form" class="max-w-[700px]">
|
|
2
2
|
<div class="font-bold py-3 border-b border-gray-200 dark:border-gray-600">
|
|
3
3
|
<%= ActiveAdmin::Comment.model_name.human(count: 2.1) %>
|
|
4
4
|
</div>
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
<% end %>
|
|
38
38
|
</div>
|
|
39
39
|
<% end %>
|
|
40
|
-
<div class="
|
|
40
|
+
<div class="py-2 lg:py-4 flex flex-col-reverse lg:flex-row gap-4 items-center justify-between">
|
|
41
41
|
<div>
|
|
42
42
|
<%= page_entries_info(comments).html_safe %>
|
|
43
43
|
</div>
|
|
44
44
|
<%= paginate(comments, views_prefix: :active_admin, outer_window: 1, window: 2) %>
|
|
45
45
|
</div>
|
|
46
46
|
<% else %>
|
|
47
|
-
<div class="
|
|
47
|
+
<div class="py-8 text-center">
|
|
48
48
|
<%= I18n.t("active_admin.comments.no_comments_yet") %>
|
|
49
49
|
</div>
|
|
50
50
|
<% end %>
|
data/lib/active_admin/menu.rb
CHANGED
|
@@ -66,8 +66,8 @@ module ActiveAdmin
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# Used in the UI to visually distinguish which menu item is selected.
|
|
69
|
-
def current?(item)
|
|
70
|
-
self == item || include?(item)
|
|
69
|
+
def current?(item, children: true)
|
|
70
|
+
self == item || (children && include?(item))
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Returns sorted array of menu items that should be displayed in this context.
|
|
@@ -71,7 +71,7 @@ module ActiveAdmin
|
|
|
71
71
|
module Base
|
|
72
72
|
def initialize(namespace, resource_class, options = {})
|
|
73
73
|
@namespace = namespace
|
|
74
|
-
@resource_class_name = "::#{resource_class.name}"
|
|
74
|
+
@resource_class_name = resource_class.respond_to?(:name) ? "::#{resource_class.name}" : resource_class.to_s
|
|
75
75
|
@options = options
|
|
76
76
|
@sort_order = options[:sort_order]
|
|
77
77
|
@member_actions = []
|
data/lib/active_admin/version.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import activeAdminPlugin from '@activeadmin/activeadmin/plugin';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Always use the last line of output since Bundler's DEBUG env will print additional lines.
|
|
5
|
+
const activeAdminPath = execSync('bundle show activeadmin', { encoding: 'utf-8' }).trim().split(/\r?\n/).pop();
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
content: [
|
data/plugin.js
CHANGED
|
@@ -165,7 +165,11 @@ export default plugin(
|
|
|
165
165
|
)}")`,
|
|
166
166
|
'print-color-adjust': `exact`,
|
|
167
167
|
},
|
|
168
|
-
[
|
|
168
|
+
[[
|
|
169
|
+
`button:not(:disabled)`,
|
|
170
|
+
`[role='button']:not(:disabled)`,
|
|
171
|
+
`[type='file']`,
|
|
172
|
+
]]: {
|
|
169
173
|
cursor: 'pointer',
|
|
170
174
|
},
|
|
171
175
|
[`[type=file]::file-selector-button`]: {
|
|
@@ -242,7 +246,7 @@ export default plugin(
|
|
|
242
246
|
'@apply w-full text-sm text-gray-800 dark:text-gray-300': {}
|
|
243
247
|
},
|
|
244
248
|
'.data-table :where(thead > tr > th)': {
|
|
245
|
-
'@apply px-3 py-3.5
|
|
249
|
+
'@apply px-3 py-3.5 font-semibold text-start text-xs uppercase border-b border-gray-200 text-gray-700 bg-gray-50 dark:bg-gray-950/50 dark:border-gray-800 dark:text-white': {}
|
|
246
250
|
},
|
|
247
251
|
'.data-table :where(thead > tr > th > a)': {
|
|
248
252
|
'@apply text-inherit no-underline inline-flex items-center gap-2': {}
|
|
@@ -350,6 +354,9 @@ export default plugin(
|
|
|
350
354
|
'.formtastic': {
|
|
351
355
|
'@apply text-sm': {}
|
|
352
356
|
},
|
|
357
|
+
'.formtastic :where(.inputs,.has-many-fields)': {
|
|
358
|
+
'@apply mb-6': {}
|
|
359
|
+
},
|
|
353
360
|
'.formtastic :where(.fieldset-title, .has-many-fields-title)': {
|
|
354
361
|
'@apply block w-full mb-3 border-b border-gray-200 dark:border-gray-800 font-bold text-lg': {}
|
|
355
362
|
},
|
|
@@ -402,10 +409,7 @@ export default plugin(
|
|
|
402
409
|
'@apply font-semibold leading-6 text-gray-900 dark:text-white no-underline': {}
|
|
403
410
|
},
|
|
404
411
|
'.formtastic :where(.has-many-add)': {
|
|
405
|
-
'@apply inline-block py-3': {}
|
|
406
|
-
},
|
|
407
|
-
'.formtastic :where(.has-many-container)': {
|
|
408
|
-
'@apply space-y-8': {}
|
|
412
|
+
'@apply inline-block py-3 mb-3': {}
|
|
409
413
|
},
|
|
410
414
|
'.formtastic :where(.has-many-fields)': {
|
|
411
415
|
'@apply ps-3 border-s-4 border-s-gray-200 dark:border-s-gray-700': {}
|
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.beta20
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charles Maresh
|
|
@@ -106,14 +106,14 @@ dependencies:
|
|
|
106
106
|
requirements:
|
|
107
107
|
- - ">="
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '7.
|
|
109
|
+
version: '7.2'
|
|
110
110
|
type: :runtime
|
|
111
111
|
prerelease: false
|
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - ">="
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '7.
|
|
116
|
+
version: '7.2'
|
|
117
117
|
- !ruby/object:Gem::Dependency
|
|
118
118
|
name: ransack
|
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|