feat: replace hardcoded navigation with CMS-managed models #33

Merged
mark merged 2 commits from feature/navigation-overhaul into main 2026-03-02 19:52:00 +00:00
Owner

Summary

Replace the entirely hardcoded nav/footer with CMS-managed Wagtail models. Editors can now control navigation items, social links, and site branding from the Wagtail admin.

Key changes

  • SiteSettings extended with branding fields: site_name, tagline, footer_description, copyright_text
  • NavigationMenuItem orderable: links to internal pages (auto-hides when unpublished) or external URLs, with show_in_header/show_in_footer toggles
  • SocialMediaLink orderable: platform + URL + icon template includes
  • New template tags: get_nav_items, get_social_links
  • Updated nav.html and footer.html to render from CMS data
  • Data migration seeds existing hardcoded values → zero visual change on deploy
  • 18 new tests (models, template tags, rendered output)

Fixes

  • Dead links: Unpublishing a page automatically removes it from navigation
  • No CMS control: All nav/footer elements now editable via Wagtail Settings

Closes #32

## Summary Replace the entirely hardcoded nav/footer with CMS-managed Wagtail models. Editors can now control navigation items, social links, and site branding from the Wagtail admin. ### Key changes - **`SiteSettings`** extended with branding fields: `site_name`, `tagline`, `footer_description`, `copyright_text` - **`NavigationMenuItem`** orderable: links to internal pages (auto-hides when unpublished) or external URLs, with `show_in_header`/`show_in_footer` toggles - **`SocialMediaLink`** orderable: platform + URL + icon template includes - New template tags: `get_nav_items`, `get_social_links` - Updated `nav.html` and `footer.html` to render from CMS data - Data migration seeds existing hardcoded values → zero visual change on deploy - 18 new tests (models, template tags, rendered output) ### Fixes - **Dead links**: Unpublishing a page automatically removes it from navigation - **No CMS control**: All nav/footer elements now editable via Wagtail Settings Closes #32
mark added 1 commit 2026-03-02 18:45:22 +00:00
feat: replace hardcoded navigation with CMS-managed models
Some checks failed
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / ci (pull_request) Failing after 14s
CI / pr-e2e (pull_request) Failing after 1m19s
8138acb7f7
Replace static nav/footer links with Wagtail-managed NavigationMenuItem
and SocialMediaLink orderables on SiteSettings. Unpublished pages are
automatically excluded from rendering, fixing the dead-link problem.

- Extend SiteSettings with site_name, tagline, footer_description,
  copyright_text branding fields
- Add NavigationMenuItem orderable (link_page/link_url, show_in_header,
  show_in_footer, sort_order) with automatic live-page filtering
- Add SocialMediaLink orderable with platform icon templates
- New template tags: get_nav_items, get_social_links
- Update nav.html and footer.html to render from CMS data
- Data migration seeds existing hardcoded values for zero-change deploy
- Update seed_e2e_content command for test/dev environments
- 18 new tests covering models, template tags, and rendered output

Closes #32

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mark force-pushed feature/navigation-overhaul from 8138acb7f7 to 98175e2fc5 2026-03-02 18:49:20 +00:00 Compare
mark force-pushed feature/navigation-overhaul from 98175e2fc5 to 1c5ba6cf90 2026-03-02 19:07:38 +00:00 Compare
mark requested review from codex_b 2026-03-02 19:18:41 +00:00
codex_b requested changes 2026-03-02 19:28:19 +00:00
Dismissed
codex_b left a comment
Owner

Requesting changes for two blockers:

  1. apps/core/migrations/0003_seed_navigation_data.py seeds SocialMediaLink.url as '/feed/' (line ~88) while the model field is URLField (apps/core/models.py line ~147). This creates invalid persisted data that fails validation in admin/forms. Repro (in PR branch): run migrations, then call full_clean() on the seeded rss row => ValidationError: Enter a valid URL. Even a plain ModelForm for that instance is invalid, so editors cannot save Site Settings without fixing that row.

  2. reverse_seed() in the same migration deletes ALL NavigationMenuItem and SocialMediaLink rows globally (lines ~96-100). On rollback, this will wipe user-created navigation/social data, not just seeded data.

Please update the seed URL/validation strategy and make reverse migration safe (or explicitly irreversible) to avoid destructive data loss.

Requesting changes for two blockers: 1) apps/core/migrations/0003_seed_navigation_data.py seeds SocialMediaLink.url as '/feed/' (line ~88) while the model field is URLField (apps/core/models.py line ~147). This creates invalid persisted data that fails validation in admin/forms. Repro (in PR branch): run migrations, then call full_clean() on the seeded rss row => ValidationError: Enter a valid URL. Even a plain ModelForm for that instance is invalid, so editors cannot save Site Settings without fixing that row. 2) reverse_seed() in the same migration deletes ALL NavigationMenuItem and SocialMediaLink rows globally (lines ~96-100). On rollback, this will wipe user-created navigation/social data, not just seeded data. Please update the seed URL/validation strategy and make reverse migration safe (or explicitly irreversible) to avoid destructive data loss.
mark added 1 commit 2026-03-02 19:36:30 +00:00
fix: address review feedback — URLField→CharField, safe reverse migration
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m14s
CI / ci (pull_request) Successful in 1m20s
d3687779a2
- Change SocialMediaLink.url and NavigationMenuItem.link_url from
  URLField to CharField(max_length=500) to support internal paths
  like /feed/ that fail URLField validation
- Replace destructive reverse_seed (deleted ALL rows) with
  RunPython.noop to prevent data loss on rollback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
Owner

Both blockers addressed in d368777:

URLField → CharField: Changed both SocialMediaLink.url and NavigationMenuItem.link_url from URLField to CharField(max_length=500). This supports both full URLs and relative paths like /feed/ that fail URLField validation. New schema migration (0004) generated.

Destructive reverse migration: Replaced reverse_seed() with migrations.RunPython.noop. Rollback no longer deletes all rows — it simply leaves the data in place.

All tests pass (88 tests, 95.5% coverage), ruff clean.

Both blockers addressed in d368777: **URLField → CharField**: Changed both `SocialMediaLink.url` and `NavigationMenuItem.link_url` from `URLField` to `CharField(max_length=500)`. This supports both full URLs and relative paths like `/feed/` that fail URLField validation. New schema migration (0004) generated. **Destructive reverse migration**: Replaced `reverse_seed()` with `migrations.RunPython.noop`. Rollback no longer deletes all rows — it simply leaves the data in place. All tests pass (88 tests, 95.5% coverage), ruff clean.
codex_b approved these changes 2026-03-02 19:50:16 +00:00
codex_b left a comment
Owner

Re-review complete. Previous blockers are resolved:

  • RSS seed no longer violates model validation (URL fields switched to path-compatible fields).
  • Reverse migration is now safe (), avoiding destructive deletion of user-created nav/social rows.

Validation run on PR head :

  • (18 passed)
  • (no changes)
  • Manual shell validation: seeded RSS row passes and a save path.

Approving.

Re-review complete. Previous blockers are resolved: - RSS seed no longer violates model validation (URL fields switched to path-compatible fields). - Reverse migration is now safe (), avoiding destructive deletion of user-created nav/social rows. Validation run on PR head : - - - (18 passed) - (no changes) - Manual shell validation: seeded RSS row passes and a save path. Approving.
mark merged commit 6342133851 into main 2026-03-02 19:52:00 +00:00
mark deleted branch feature/navigation-overhaul 2026-03-02 19:52:00 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nohype/main-site#33