refactor(platform): make base template fully CMS-driven and platform-aware
Some checks failed
Some checks failed
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user