activeadmin_favorites 0.1.7 → 0.1.8

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: 87ee6c5a7e74841630d69de986dcc7dfef4f799e094f696529b3fe51b6c53552
4
- data.tar.gz: b9381534a09f71b745c9d3a317d4890c0a21391c27be544e421be5b76cda43c2
3
+ metadata.gz: 1c6a1ca67243ef7bcf12defce94d288b0afca716511a3a04f6326ecce641e784
4
+ data.tar.gz: 0150e3932226fe8890a22dac1889d57f8e74fb868928ec8027763a8e07acfc0c
5
5
  SHA512:
6
- metadata.gz: 422903c24269839ed1142a83e6c8fcc1f5aff493eba16a6d91574869eaaf8c64dcdde3b650c8ce4a90a29f56c4bdc2f656881204e44bb6a60b135eb7ece956e7
7
- data.tar.gz: f9bf4dabb5f05f413a031b90694af82929117f14c5b3855c05be0c057f39d66441a83e68d755826ef4ff180a3e367f4f04d18a66a9e57c8d23c29f5965a8e893
6
+ metadata.gz: 520cd1dec8f6f362b90163d65f8a3d3231f603481a7f95354600cd455cde6fbe37eaaae3bd5b3f26e90cae6bd784075b4dfb4432b4f43747cde70f25ff2ba7fe
7
+ data.tar.gz: 510d6d7d6b0bc26017bca1d6ff576ba3e835f95215dba7a299ca810d40ea44d541f88e21526449a575f27b41535b1fb1e1e76a5902d9947223a132d3d5984d04
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.8 (2026-10-29)
4
+
5
+ - Fix Active Admin view-path detection so sibling gems such as `activeadmin-command_palette` are not treated as Active Admin. Prefer `ActiveAdmin::Engine.root`, with a fallback that requires a digit version segment after `activeadmin-`.
6
+ - Remove the gem `active_admin/_html_head` override. Hosts must link `activeadmin_favorites/personalization_menu` from their own Active Admin head.
7
+
3
8
  ## 0.1.7 (2026-10-29)
4
9
 
5
10
  - Fix engine view path order so favorites sits immediately before ActiveAdmin and host `app/views` stays ahead of the gem `_html_head`. Rails engines prepend view paths; the previous reorder left favorites first whenever it was already ahead of ActiveAdmin.
data/README.md CHANGED
@@ -61,9 +61,7 @@ When using ActionPolicy, add `save_lens_favorite?` and `reset?` to `ActiveAdmin:
61
61
 
62
62
  ### Stylesheet
63
63
 
64
- The engine ships an `active_admin/_html_head` that links `activeadmin_favorites/personalization_menu` so the cogwheel dropdown can scroll the catalog while keeping action buttons in view. The file is plain CSS served through Propshaft; it does not need Tailwind processing. Engine view paths sit immediately before ActiveAdmin's, so a host `app/views/active_admin/_html_head` still wins.
65
-
66
- If the host overrides that partial, add the link there:
64
+ Link `activeadmin_favorites/personalization_menu` from the host Active Admin HTML head so the cogwheel dropdown can scroll the catalog while keeping action buttons in view. The file is plain CSS served through Propshaft; it does not need Tailwind processing. The gem does not ship `active_admin/_html_head`, so customized host heads keep their stylesheet names and extra tags.
67
65
 
68
66
  ```erb
69
67
  <%= stylesheet_link_tag "activeadmin_favorites/personalization_menu" %>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveAdmin
4
4
  module Favorites
5
- VERSION = "0.1.7"
5
+ VERSION = "0.1.8"
6
6
  end
7
7
  end
@@ -4,8 +4,7 @@ module ActiveAdmin
4
4
  module Favorites
5
5
  # Place this engine's views immediately before ActiveAdmin's so resource
6
6
  # index/show overrides (catalog injection) win. Rails engines prepend their
7
- # view paths, so favorites can otherwise sit ahead of the host app/views and
8
- # shadow customized templates such as active_admin/_html_head.
7
+ # view paths, so favorites can otherwise sit ahead of the host app/views.
9
8
  module ViewPaths
10
9
  module_function
11
10
 
@@ -35,7 +34,16 @@ module ActiveAdmin
35
34
  end
36
35
 
37
36
  def active_admin_views_root(path_strings)
38
- path_strings.find { |path| path.match?(%r{/gems/activeadmin-[^/]+/app/views\z}) }
37
+ engine_root = active_admin_engine_views_root
38
+ return engine_root if engine_root && path_strings.include?(engine_root)
39
+
40
+ path_strings.find { |path| path.match?(ACTIVE_ADMIN_GEM_VIEWS) }
41
+ end
42
+
43
+ def active_admin_engine_views_root
44
+ return unless defined?(::ActiveAdmin::Engine)
45
+
46
+ ::ActiveAdmin::Engine.root.join("app/views").to_s
39
47
  end
40
48
 
41
49
  def already_before_active_admin?(path_strings, favorites_root, active_admin_root)
@@ -49,10 +57,16 @@ module ActiveAdmin
49
57
  moved
50
58
  end
51
59
 
60
+ # Versioned Active Admin gem only (`activeadmin-4...`), not siblings such as
61
+ # `activeadmin-command_palette-...`.
62
+ ACTIVE_ADMIN_GEM_VIEWS = %r{/gems/activeadmin-\d[^/]*/app/views\z}
63
+
52
64
  module_function :reorder_path_strings, :active_admin_views_root,
53
- :already_before_active_admin?, :place_before_active_admin
65
+ :active_admin_engine_views_root, :already_before_active_admin?,
66
+ :place_before_active_admin
54
67
  private_class_method :reorder_path_strings, :active_admin_views_root,
55
- :already_before_active_admin?, :place_before_active_admin
68
+ :active_admin_engine_views_root, :already_before_active_admin?,
69
+ :place_before_active_admin
56
70
  end
57
71
  end
58
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_favorites
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
@@ -355,7 +355,6 @@ files:
355
355
  - app/models/active_admin/favorites/lens_favorite.rb
356
356
  - app/models/active_admin/favorites/view_lens/layout.rb
357
357
  - app/models/active_admin/favorites/view_lens_default.rb
358
- - app/views/active_admin/_html_head.html.erb
359
358
  - app/views/active_admin/favorites/_lens_catalog_data.html.erb
360
359
  - app/views/active_admin/favorites/_macro_fields.html.erb
361
360
  - app/views/active_admin/favorites/_personalization_trigger.html.erb
@@ -1,14 +0,0 @@
1
- <%= stylesheet_link_tag "active_admin" %>
2
- <%= stylesheet_link_tag ActiveAdmin::Favorites::PERSONALIZATION_MENU_STYLESHEET %>
3
- <meta name="viewport" content="width=device-width,initial-scale=1">
4
- <%= csrf_meta_tags %>
5
- <%= csp_meta_tag %>
6
- <% # On page load or when changing themes, best to add inline in `head` to avoid FOUC %>
7
- <%= javascript_tag nonce: true do %>
8
- if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
9
- document.documentElement.classList.add('dark')
10
- } else {
11
- document.documentElement.classList.remove('dark')
12
- }
13
- <% end %>
14
- <%= javascript_importmap_tags "active_admin", importmap: ActiveAdmin.importmap %>