activeadmin 4.0.0.beta19 → 4.0.0.beta21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f0339fceef3e3092cf17f883d9f2783ed7915a50341481259629a11579c36b9
4
- data.tar.gz: 3a06b83b19d71e2487c13ffd99a927cc05b99e3ec337754ac1d999c11c1ed117
3
+ metadata.gz: 2ebf350f462941c42e619393d90d4a302b49f1536d3dd53a2fb5a8047a21a66a
4
+ data.tar.gz: bf556f211740563b2626f9eb8b24a2d7dde9f76f31abf1bdd22740845111bf08
5
5
  SHA512:
6
- metadata.gz: e73a080ffa79cdf603c817c9367f72354e66d87e9fab5fff4cfab39cdaf69b5ae128dc8847f091b4ac0dac6c80756592d2d19c4d203940cc4ea843404d76312c
7
- data.tar.gz: 552c837611062b12c3a28f9024a1791141ed0259c1bad2328350f79f45280cb72957dff97949760163ce12e8b03e58db7b87c018272921b40017cc8f98a54d20
6
+ metadata.gz: 78b2f3a7a1fdc6f4afe636955d4dac033d78f0733ccbc26e367458000025366f70cf720bafa5cc8c68cff834a897608908afb9592d63c17b48ed73006ac286bf
7
+ data.tar.gz: 22309da1320f3b56619d99f21cee368554a6145369ab9f9f26196d70214b2fb98bc9e0665f0156a39a96c8f8db6bbd386d75b9cbaae9604ee053563563f02844
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.beta19"` and then run `gem install activeadmin --pre`.
10
+ Update your `Gemfile` with `gem "activeadmin", "4.0.0.beta21"` 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-beta19
17
+ yarn add @activeadmin/activeadmin@4.0.0-beta21
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 to 4.0.0.beta19
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(event) {
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
- <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') %>">
8
- <%= item.label(self) %>
9
- <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">
10
- <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" />
11
- </svg>
12
- </button>
13
- <ul role="list" class="mt-1 space-y-1 hidden group-data-open:block">
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
- <%= item.label(self) %>
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="p-2 lg:p-4 flex flex-col-reverse lg:flex-row gap-4 items-center justify-between">
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="p-8 text-center">
47
+ <div class="py-8 text-center">
48
48
  <%= I18n.t("active_admin.comments.no_comments_yet") %>
49
49
  </div>
50
50
  <% end %>
@@ -11,9 +11,7 @@ module ActiveAdmin
11
11
  end
12
12
 
13
13
  def count
14
- value = @promise.value
15
- # value.value due to Rails bug https://github.com/rails/rails/issues/50776
16
- value.respond_to?(:value) ? value.value : value
14
+ @promise.value
17
15
  end
18
16
 
19
17
  alias size count
@@ -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 = []
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveAdmin
3
- VERSION = "4.0.0.beta19"
3
+ VERSION = "4.0.0.beta21"
4
4
  end
@@ -1,7 +1,8 @@
1
1
  import { execSync } from 'child_process';
2
2
  import activeAdminPlugin from '@activeadmin/activeadmin/plugin';
3
3
 
4
- const activeAdminPath = execSync('bundle show activeadmin', { encoding: 'utf-8' }).trim();
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
- [`[type='file']`]: {
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`]: {
@@ -190,6 +194,11 @@ export default plugin(
190
194
  [['[type=datetime-local]', '[type=month]', '[type=week]', '[type=search]', '[type=date]', '[type=email]', '[type=number]', '[type=password]', '[type=tel]', '[type=text]', '[type=time]', '[type=url]', 'select', 'textarea']]: {
191
195
  '@apply bg-gray-50 border border-gray-300 text-gray-900 placeholder:text-gray-400 rounded-md focus:ring-blue-500 focus:border-blue-500 w-full dark:bg-white/5 dark:border-white/10 dark:text-white dark:placeholder:text-gray-500 dark:focus:ring-blue-500 dark:focus:border-blue-500': {}
192
196
  },
197
+ [':where(select:not([multiple]))']: {
198
+ 'option, optgroup': {
199
+ '@apply dark:bg-gray-800': {}
200
+ }
201
+ },
193
202
  'a': {
194
203
  '@apply text-blue-600 dark:text-blue-500 underline underline-offset-[.2rem]': {}
195
204
  },
@@ -242,7 +251,7 @@ export default plugin(
242
251
  '@apply w-full text-sm text-gray-800 dark:text-gray-300': {}
243
252
  },
244
253
  '.data-table :where(thead > tr > th)': {
245
- '@apply px-3 py-3.5 whitespace-nowrap 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': {}
254
+ '@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
255
  },
247
256
  '.data-table :where(thead > tr > th > a)': {
248
257
  '@apply text-inherit no-underline inline-flex items-center gap-2': {}
@@ -350,6 +359,9 @@ export default plugin(
350
359
  '.formtastic': {
351
360
  '@apply text-sm': {}
352
361
  },
362
+ '.formtastic :where(.inputs,.has-many-fields)': {
363
+ '@apply mb-6': {}
364
+ },
353
365
  '.formtastic :where(.fieldset-title, .has-many-fields-title)': {
354
366
  '@apply block w-full mb-3 border-b border-gray-200 dark:border-gray-800 font-bold text-lg': {}
355
367
  },
@@ -402,10 +414,7 @@ export default plugin(
402
414
  '@apply font-semibold leading-6 text-gray-900 dark:text-white no-underline': {}
403
415
  },
404
416
  '.formtastic :where(.has-many-add)': {
405
- '@apply inline-block py-3': {}
406
- },
407
- '.formtastic :where(.has-many-container)': {
408
- '@apply space-y-8': {}
417
+ '@apply inline-block py-3 mb-3': {}
409
418
  },
410
419
  '.formtastic :where(.has-many-fields)': {
411
420
  '@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.beta19
4
+ version: 4.0.0.beta21
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.0'
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.0'
116
+ version: '7.2'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: ransack
119
119
  requirement: !ruby/object:Gem::Requirement