activeadmin_favorites 0.1.2 → 0.1.4
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 +8 -0
- data/app/views/active_admin/favorites/_lens_catalog_data.html.erb +1 -1
- data/lib/activeadmin/favorites/engine.rb +7 -0
- data/lib/activeadmin/favorites/register_favorites.rb +4 -4
- data/lib/activeadmin/favorites/version.rb +1 -1
- data/lib/activeadmin/favorites/view_paths.rb +48 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e9bfde6f82c66411cf985ef89e74433f9f6651726d8ae554e32c4a56852a6f0
|
|
4
|
+
data.tar.gz: ea0ec745f66df6282044bdbea08598072e34194c2a6d78efb1629d441595b778
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b677efa90bdf4b467645703ec784c25a22d652e837b98b8daeaaa5eb755349e1040dd8f564b2025a3f6ba0d0450e34996a916ad031069f85febb3d80a2739677
|
|
7
|
+
data.tar.gz: db2cbb3c3a772863a0a46451e6830470737e199265d8fdfc70b0fe13d7ed351b5719143746011d6ce6b55b1fe49eb817166f343fc0cd9661806034a3a0b78388
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.1.4 (2026-10-26)
|
|
4
|
+
|
|
5
|
+
- Fix column and panel personalization so the lens catalog on index and show pages parses in the browser.
|
|
6
|
+
|
|
7
|
+
## 0.1.3 (2026-10-13)
|
|
8
|
+
|
|
9
|
+
- Fix favorites index kind tabs so they render as links instead of raw kind list text.
|
|
10
|
+
|
|
3
11
|
## 0.1.2 (2026-10-07)
|
|
4
12
|
|
|
5
13
|
- Show Favorites as the favorites index heading from the gem locale.
|
|
@@ -16,6 +16,7 @@ module ActiveAdmin
|
|
|
16
16
|
require "activeadmin/favorites/view_lens/catalog"
|
|
17
17
|
require "activeadmin/favorites/view_lens/patches"
|
|
18
18
|
require "activeadmin/favorites/view_lens/resource_dsl"
|
|
19
|
+
require "activeadmin/favorites/view_paths"
|
|
19
20
|
require "activeadmin/favorites/install"
|
|
20
21
|
require "activeadmin/favorites/register_favorites"
|
|
21
22
|
require "activeadmin/favorites/register_view_lens_preferences"
|
|
@@ -62,7 +63,13 @@ module ActiveAdmin
|
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
66
|
+
config.after_initialize do
|
|
67
|
+
ActiveAdmin::Favorites::ViewPaths.install!
|
|
68
|
+
end
|
|
69
|
+
|
|
65
70
|
config.to_prepare do
|
|
71
|
+
ActiveAdmin::Favorites::ViewPaths.install!
|
|
72
|
+
|
|
66
73
|
next unless defined?(ActiveAdmin::ResourceController)
|
|
67
74
|
|
|
68
75
|
ActiveAdmin::Favorites::Favorite.define_favorites_user_association!
|
|
@@ -186,12 +186,12 @@ module ActiveAdmin
|
|
|
186
186
|
|
|
187
187
|
index title: proc { I18n.t("active_admin.favorites.title") } do
|
|
188
188
|
nav class: "flex flex-wrap gap-3 mb-4", "aria-label": I18n.t("active_admin.favorites.kind_navigation") do
|
|
189
|
-
|
|
190
|
-
admin_favorites_path,
|
|
189
|
+
a I18n.t("active_admin.favorites.kinds.all"),
|
|
190
|
+
href: admin_favorites_path,
|
|
191
191
|
class: favorites_kind_tab_active?(nil) ? "font-semibold underline" : "text-gray-600 dark:text-gray-300"
|
|
192
192
|
Favorite::KINDS.each do |kind|
|
|
193
|
-
|
|
194
|
-
admin_favorites_path(kind: kind),
|
|
193
|
+
a I18n.t("active_admin.favorites.kinds.#{kind}"),
|
|
194
|
+
href: admin_favorites_path(kind: kind),
|
|
195
195
|
class: favorites_kind_tab_active?(kind) ? "font-semibold underline" : "text-gray-600 dark:text-gray-300"
|
|
196
196
|
end
|
|
197
197
|
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ActiveAdmin
|
|
4
|
+
module Favorites
|
|
5
|
+
# Place this engine's views ahead of ActiveAdmin's so resource index/show
|
|
6
|
+
# overrides (catalog injection) win, while the host app/views path stays first.
|
|
7
|
+
module ViewPaths
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
def prefer_over_active_admin!(view_paths)
|
|
11
|
+
path_strings = view_paths.to_a.map { |path| path.to_s }
|
|
12
|
+
reordered = reorder_path_strings(path_strings)
|
|
13
|
+
return view_paths if reordered.equal?(path_strings)
|
|
14
|
+
|
|
15
|
+
ActionView::PathSet.new(reordered)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def install!
|
|
19
|
+
return unless defined?(ActionController::Base)
|
|
20
|
+
|
|
21
|
+
ActionController::Base.view_paths = prefer_over_active_admin!(
|
|
22
|
+
ActionController::Base.view_paths
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def reorder_path_strings(path_strings)
|
|
27
|
+
favorites_root = Engine.root.join("app/views").to_s
|
|
28
|
+
return path_strings unless path_strings.include?(favorites_root)
|
|
29
|
+
|
|
30
|
+
active_admin_root = path_strings.find do |path|
|
|
31
|
+
path.match?(%r{/gems/activeadmin-[^/]+/app/views\z})
|
|
32
|
+
end
|
|
33
|
+
return path_strings unless active_admin_root
|
|
34
|
+
|
|
35
|
+
favorites_index = path_strings.index(favorites_root)
|
|
36
|
+
active_admin_index = path_strings.index(active_admin_root)
|
|
37
|
+
return path_strings if favorites_index < active_admin_index
|
|
38
|
+
|
|
39
|
+
moved = path_strings.dup
|
|
40
|
+
moved.delete_at(favorites_index)
|
|
41
|
+
moved.insert(moved.index(active_admin_root), favorites_root)
|
|
42
|
+
moved
|
|
43
|
+
end
|
|
44
|
+
module_function :reorder_path_strings
|
|
45
|
+
private_class_method :reorder_path_strings
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
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.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -381,6 +381,7 @@ files:
|
|
|
381
381
|
- lib/activeadmin/favorites/view_lens/current.rb
|
|
382
382
|
- lib/activeadmin/favorites/view_lens/patches.rb
|
|
383
383
|
- lib/activeadmin/favorites/view_lens/resource_dsl.rb
|
|
384
|
+
- lib/activeadmin/favorites/view_paths.rb
|
|
384
385
|
- lib/activeadmin_favorites.rb
|
|
385
386
|
- lib/generators/activeadmin_favorites/install/templates/favorite_policy.rb
|
|
386
387
|
- lib/generators/activeadmin_favorites/install/templates/initializer.rb
|