From b5b73559b563a39b5330494ec132fd0becfb7e6b Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Sun, 1 Mar 2026 17:41:24 +0100 Subject: [PATCH] refactor(platform): make base template fully CMS-driven and platform-aware Remove all hardcoded OMS-specific content from platform base template: nav links, contact info, brand name, and footer columns. Everything is now dynamic via platform model and CMS page queries. Wire up legal_pages context (privacy/terms) from database instead of hardcoded fallback. Co-Authored-By: Claude Opus 4.6 --- app/modules/cms/definition.py | 8 +- .../cms/services/content_page_service.py | 5 ++ app/templates/platform/base.html | 78 +++++-------------- app/templates_config.py | 2 + 4 files changed, 32 insertions(+), 61 deletions(-) diff --git a/app/modules/cms/definition.py b/app/modules/cms/definition.py index 3f8a8270..90b23de6 100644 --- a/app/modules/cms/definition.py +++ b/app/modules/cms/definition.py @@ -45,6 +45,7 @@ def _get_platform_context(request: Any, db: Any, platform: Any) -> dict[str, Any header_pages = [] footer_pages = [] + legal_pages = [] try: header_pages = content_page_service.list_platform_pages( @@ -53,8 +54,11 @@ def _get_platform_context(request: Any, db: Any, platform: Any) -> dict[str, Any footer_pages = content_page_service.list_platform_pages( db, platform_id=platform_id, footer_only=True, include_unpublished=False ) + legal_pages = content_page_service.list_platform_pages( + db, platform_id=platform_id, legal_only=True, include_unpublished=False + ) logger.debug( - f"[CMS] Platform context: {len(header_pages)} header, {len(footer_pages)} footer pages" + f"[CMS] Platform context: {len(header_pages)} header, {len(footer_pages)} footer, {len(legal_pages)} legal pages" ) except Exception as e: logger.warning(f"[CMS] Failed to load platform navigation pages: {e}") @@ -62,7 +66,7 @@ def _get_platform_context(request: Any, db: Any, platform: Any) -> dict[str, Any return { "header_pages": header_pages, "footer_pages": footer_pages, - "legal_pages": [], # TODO: Add legal pages support if needed + "legal_pages": legal_pages, } diff --git a/app/modules/cms/services/content_page_service.py b/app/modules/cms/services/content_page_service.py index e42274f7..dec8242d 100644 --- a/app/modules/cms/services/content_page_service.py +++ b/app/modules/cms/services/content_page_service.py @@ -282,6 +282,7 @@ class ContentPageService: include_unpublished: bool = False, footer_only: bool = False, header_only: bool = False, + legal_only: bool = False, ) -> list[ContentPage]: """ List platform marketing pages. @@ -292,6 +293,7 @@ class ContentPageService: include_unpublished: Include draft pages footer_only: Only pages marked for footer display header_only: Only pages marked for header display + legal_only: Only legal pages (privacy, terms) — not in header or footer nav Returns: List of platform marketing ContentPage objects @@ -311,6 +313,9 @@ class ContentPageService: if header_only: filters.append(ContentPage.show_in_header == True) + if legal_only: + filters.append(ContentPage.slug.in_(["privacy", "terms"])) + return ( db.query(ContentPage) .filter(and_(*filters)) diff --git a/app/templates/platform/base.html b/app/templates/platform/base.html index a3207247..b56481b5 100644 --- a/app/templates/platform/base.html +++ b/app/templates/platform/base.html @@ -7,10 +7,10 @@ {# Dynamic page title #} - {% block title %}Orion - Order Management for Letzshop Sellers{% endblock %} + {% block title %}{{ platform.name if platform else 'Wizard' }}{% endblock %} {# SEO Meta Tags #} - + {# Favicon #} @@ -61,28 +61,16 @@ - {# Desktop Navigation #} + {# Desktop Navigation (CMS-driven) #}