activeadmin_favorites 0.1.6 → 0.1.7
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 +4 -0
- data/README.md +2 -2
- data/lib/activeadmin/favorites/version.rb +1 -1
- data/lib/activeadmin/favorites/view_paths.rb +24 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87ee6c5a7e74841630d69de986dcc7dfef4f799e094f696529b3fe51b6c53552
|
|
4
|
+
data.tar.gz: b9381534a09f71b745c9d3a317d4890c0a21391c27be544e421be5b76cda43c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 422903c24269839ed1142a83e6c8fcc1f5aff493eba16a6d91574869eaaf8c64dcdde3b650c8ce4a90a29f56c4bdc2f656881204e44bb6a60b135eb7ece956e7
|
|
7
|
+
data.tar.gz: f9bf4dabb5f05f413a031b90694af82929117f14c5b3855c05be0c057f39d66441a83e68d755826ef4ff180a3e367f4f04d18a66a9e57c8d23c29f5965a8e893
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.1.7 (2026-10-29)
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
|
|
3
7
|
## 0.1.6 (2026-10-27)
|
|
4
8
|
|
|
5
9
|
- Link the personalization menu stylesheet from Active Admin's HTML head so hosts no longer need a Tailwind `@import` of the Propshaft path.
|
data/README.md
CHANGED
|
@@ -61,9 +61,9 @@ When using ActionPolicy, add `save_lens_favorite?` and `reset?` to `ActiveAdmin:
|
|
|
61
61
|
|
|
62
62
|
### Stylesheet
|
|
63
63
|
|
|
64
|
-
The engine links `activeadmin_favorites/personalization_menu`
|
|
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
65
|
|
|
66
|
-
If the host overrides
|
|
66
|
+
If the host overrides that partial, add the link there:
|
|
67
67
|
|
|
68
68
|
```erb
|
|
69
69
|
<%= stylesheet_link_tag "activeadmin_favorites/personalization_menu" %>
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module ActiveAdmin
|
|
4
4
|
module Favorites
|
|
5
|
-
# Place this engine's views
|
|
6
|
-
# overrides (catalog injection) win
|
|
5
|
+
# Place this engine's views immediately before ActiveAdmin's so resource
|
|
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
9
|
module ViewPaths
|
|
8
10
|
module_function
|
|
9
11
|
|
|
10
12
|
def prefer_over_active_admin!(view_paths)
|
|
11
13
|
path_strings = view_paths.to_a.map { |path| path.to_s }
|
|
12
14
|
reordered = reorder_path_strings(path_strings)
|
|
13
|
-
return view_paths if reordered
|
|
15
|
+
return view_paths if reordered == path_strings
|
|
14
16
|
|
|
15
17
|
ActionView::PathSet.new(reordered)
|
|
16
18
|
end
|
|
@@ -25,24 +27,32 @@ module ActiveAdmin
|
|
|
25
27
|
|
|
26
28
|
def reorder_path_strings(path_strings)
|
|
27
29
|
favorites_root = Engine.root.join("app/views").to_s
|
|
28
|
-
|
|
30
|
+
active_admin_root = active_admin_views_root(path_strings)
|
|
31
|
+
return path_strings unless path_strings.include?(favorites_root) && active_admin_root
|
|
32
|
+
return path_strings if already_before_active_admin?(path_strings, favorites_root, active_admin_root)
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
33
|
-
return path_strings unless active_admin_root
|
|
34
|
+
place_before_active_admin(path_strings, favorites_root, active_admin_root)
|
|
35
|
+
end
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
def active_admin_views_root(path_strings)
|
|
38
|
+
path_strings.find { |path| path.match?(%r{/gems/activeadmin-[^/]+/app/views\z}) }
|
|
39
|
+
end
|
|
38
40
|
|
|
41
|
+
def already_before_active_admin?(path_strings, favorites_root, active_admin_root)
|
|
42
|
+
path_strings.index(favorites_root) == path_strings.index(active_admin_root) - 1
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def place_before_active_admin(path_strings, favorites_root, active_admin_root)
|
|
39
46
|
moved = path_strings.dup
|
|
40
|
-
moved.
|
|
47
|
+
moved.delete(favorites_root)
|
|
41
48
|
moved.insert(moved.index(active_admin_root), favorites_root)
|
|
42
49
|
moved
|
|
43
50
|
end
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
|
|
52
|
+
module_function :reorder_path_strings, :active_admin_views_root,
|
|
53
|
+
:already_before_active_admin?, :place_before_active_admin
|
|
54
|
+
private_class_method :reorder_path_strings, :active_admin_views_root,
|
|
55
|
+
:already_before_active_admin?, :place_before_active_admin
|
|
46
56
|
end
|
|
47
57
|
end
|
|
48
58
|
end
|