Skip to content

Remove Legal module from core (extracted to phoenix_kit_legal) - #458

Merged
ddon merged 5 commits into
BeamLabEU:devfrom
timujinne:legal-cookie-consent-fix
Mar 28, 2026
Merged

Remove Legal module from core (extracted to phoenix_kit_legal)#458
ddon merged 5 commits into
BeamLabEU:devfrom
timujinne:legal-cookie-consent-fix

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Summary

  • Extract Legal module into standalone package phoenix_kit_legal (repo: BeamLabEU/phoenix_kit_legal)
  • Add Code.ensure_loaded? guards for all Legal integration points in core
  • Core compiles and passes mix quality without Legal package installed

Changes

Deleted from core (moved to package)

  • lib/modules/legal/ — 8 files (context, structs, schema, service, LiveView, README)
  • lib/phoenix_kit_web/controllers/consent_config_controller.ex — API controller
  • lib/phoenix_kit_web/components/core/cookie_consent.ex — Phoenix component
  • priv/static/assets/phoenix_kit_consent.js — consent widget JS
  • priv/legal_templates/*.eex — 7 legal page templates

Modified in core (guards added)

  • integration.ex — conditional routes + @compile {:no_warn_undefined}
  • layout_wrapper.ex — conditional consent widget + JS script tag
  • root.html.heex / dashboard.html.heex — conditional consent blocks
  • layouts.ex@compile {:no_warn_undefined} for Legal.CookieConsent
  • assets_controller.ex — removed consent.js from static map
  • auth.ex — removed Legal tab mapping + @compile {:no_warn_undefined}
  • phoenix_kit_web.ex — removed CookieConsent import
  • module_registry.ex — removed Legal from internal_modules
  • .dialyzer_ignore.exs — updated for extracted Legal references

Package features (in phoenix_kit_legal repo)

  • Namespace preserved: PhoenixKit.Modules.Legal.*
  • Depends on phoenix_kit ~> 1.7 + phoenix_kit_publishing
  • Robustness fix: handles trashed/orphaned posts transparently
  • Diagnostic tool + reset button (only visible when issues detected)

Test Plan

  • mix quality passes (format + credo + dialyzer)
  • Core compiles without Legal package
  • Package compiles standalone
  • Decor 3D Print compiles with package as path dep

All module admin views (customer_service, storage, db, referrals,
maintenance, sitemap) were wrapped in LayoutWrapper.app_layout,
but they render inside admin live_session which already applies
the admin layout. This caused double sidebar rendering.

Remove the redundant wrapper from 16 .heex templates and 1 .ex
file, keeping only the inner content div.
Register /dashboard/billing-profiles routes conditionally when
phoenix_kit_billing package is installed. Follows the same
Code.ensure_loaded? pattern used for shop user routes.
Adds index, new, and edit routes for both localized and
non-localized variants.
- Delete lib/modules/legal/ (8 files), cookie_consent component,
  consent_config_controller, phoenix_kit_consent.js, legal_templates/
- Add Code.ensure_loaded? guards in integration.ex, layout_wrapper.ex,
  root.html.heex, dashboard.html.heex, auth.ex, layouts.ex
- Remove CookieConsent import from phoenix_kit_web.ex core_components
- Remove phoenix_kit_consent.js from assets_controller static map
- Add @compile {:no_warn_undefined} for Legal modules in integration.ex,
  layout_wrapper.ex, layouts.ex, auth.ex
- Update .dialyzer_ignore.exs for extracted Legal references
Missed in previous commit: 4 storage templates and maintenance
settings.ex still had the duplicate LayoutWrapper wrapper.
@ddon
ddon merged commit 3d66451 into BeamLabEU:dev Mar 28, 2026
6 checks passed
ddon added a commit that referenced this pull request Mar 28, 2026
…w docs

Dashboard layout loaded consent JS but never rendered the widget component.
Users on /dashboard/* pages would never see the cookie consent banner.
Added the widget block matching the pattern in root.html.heex.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ddon added a commit that referenced this pull request Mar 28, 2026
…w docs

The dashboard.html.heex layout loaded phoenix_kit_consent.js but never
rendered the cookie consent widget component. Users on /dashboard/* pages
would not see the consent banner even with phoenix_kit_legal installed.

Also standardizes the consent component attribute order to match
layout_wrapper.ex and adds dashboard.html.heex to dialyzer ignore list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants