redirect /admin/theme to on-site editor at /?edit=theme
All checks were successful
deploy / deploy (push) Successful in 1m41s

- Phase 5 was already implemented (URL mode activation via ?edit param)
- Phase 6: Add RedirectController to redirect /admin/theme → /?edit=theme
- Update admin sidebar and dashboard links to point directly to /?edit=theme
- Delete old Admin.Theme.Index LiveView and template (no longer needed)
- Update tests for new redirect behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-09 20:30:33 +00:00
parent 378b3fdb6b
commit 6f0b7f4f63
11 changed files with 34 additions and 1543 deletions

View File

@@ -1,12 +1,11 @@
defmodule BerrypodWeb.ThemeCSSConsistencyTest do
@moduledoc """
Tests that verify CSS works correctly for both the theme editor
preview and the shop pages using the shared .themed class.
Tests that verify CSS works correctly for shop pages using the .themed class.
Architecture:
- Both shop pages and preview use .themed class for shared styles
- Theme editor uses .preview-frame[data-*] selectors for live switching (in admin.css)
- Shop pages get theme values via inline CSS from CSSGenerator (shop.css)
- Shop pages use .themed class for theme-aware styles
- Theme editor is on-site (/?edit=theme) so it uses the same CSS as shop pages
- Shop pages get theme values via inline CSS from CSSGenerator
- Component styles use .themed for shared styling (theme-layer2-attributes.css)
"""
@@ -34,11 +33,12 @@ defmodule BerrypodWeb.ThemeCSSConsistencyTest do
assert html =~ ~r/data-density="/
end
test "theme editor has .themed with data attributes", %{conn: conn, user: user} do
test "on-site theme editor has .themed with data attributes", %{conn: conn, user: user} do
conn = log_in_user(conn, user)
{:ok, _view, html} = live(conn, ~p"/admin/theme")
# Theme editor is now on-site at /?edit=theme
{:ok, _view, html} = live(conn, ~p"/?edit=theme")
# Verify themed element exists in preview-frame with theme data attributes
# Verify themed element exists with theme data attributes
assert html =~ ~r/<div[^>]*class="themed/
assert html =~ ~r/data-mood="/
assert html =~ ~r/data-typography="/
@@ -46,26 +46,6 @@ defmodule BerrypodWeb.ThemeCSSConsistencyTest do
assert html =~ ~r/data-density="/
end
test "shop page uses same theme settings as preview", %{conn: conn, user: user} do
# Set a specific theme configuration
{:ok, _settings} = Settings.apply_preset(:night)
# Check shop page (logged in since site_live is false by default)
conn = log_in_user(conn, user)
{:ok, _view, shop_html} = live(conn, ~p"/")
# Check preview (already authenticated)
{:ok, _view, preview_html} = live(conn, ~p"/admin/theme")
# Extract data-mood values from both
[_, shop_mood] = Regex.run(~r/data-mood="([^"]+)"/, shop_html)
[_, preview_mood] = Regex.run(~r/data-mood="([^"]+)"/, preview_html)
# They should match
assert shop_mood == preview_mood
assert shop_mood == "dark"
end
test "theme settings changes are reflected on shop page", %{conn: conn, user: user} do
conn = log_in_user(conn, user)