feat: implement section-based homepage management system
Add structured JSON sections to ContentPage for multi-language homepage editing:
Database:
- Add `sections` JSON column to content_pages table
- Migration z8i9j0k1l2m3 adds the column
Schema:
- New models/schema/homepage_sections.py with Pydantic schemas
- TranslatableText for language-keyed translations
- HeroSection, FeaturesSection, PricingSection, CTASection
Templates:
- New section partials in app/templates/platform/sections/
- Updated homepage-default.html to render sections dynamically
- Fallback to placeholder content when sections not configured
Service:
- update_homepage_sections() - validate and save all sections
- update_single_section() - update individual section
- get_default_sections() - empty structure for new homepages
API:
- GET /{page_id}/sections - get sections with platform languages
- PUT /{page_id}/sections - update all sections
- PUT /{page_id}/sections/{section_name} - update single section
Admin UI:
- Section editor appears when editing homepage (slug='home')
- Language tabs from platform.supported_languages
- Accordion sections for Hero, Features, Pricing, CTA
- Button/feature card repeaters with add/remove
Also fixes broken line 181 in z4e5f6a7b8c9 migration.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -178,7 +178,9 @@ def upgrade() -> None:
|
||||
""")
|
||||
)
|
||||
|
||||
I dn
|
||||
# Get OMS platform ID for backfilling
|
||||
result = conn.execute(sa.text("SELECT id FROM platforms WHERE code = 'oms'"))
|
||||
oms_platform_id = result.fetchone()[0]
|
||||
|
||||
# =========================================================================
|
||||
# 6. Backfill content_pages with platform_id
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Add sections column to content_pages
|
||||
|
||||
Revision ID: z8i9j0k1l2m3
|
||||
Revises: z7h8i9j0k1l2
|
||||
Create Date: 2026-01-23
|
||||
|
||||
Adds sections JSON column for structured homepage editing with multi-language support.
|
||||
The sections column stores hero, features, pricing, and cta configurations
|
||||
with TranslatableText pattern for i18n.
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "z8i9j0k1l2m3"
|
||||
down_revision = "z7h8i9j0k1l2"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"content_pages",
|
||||
sa.Column(
|
||||
"sections",
|
||||
sa.JSON(),
|
||||
nullable=True,
|
||||
comment="Structured homepage sections (hero, features, pricing, cta) with i18n",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("content_pages", "sections")
|
||||
Reference in New Issue
Block a user