Skip to content

Cms home springboard - WT-659#17030

Open
wen-2018 wants to merge 14 commits intomainfrom
cms-home-springboard
Open

Cms home springboard - WT-659#17030
wen-2018 wants to merge 14 commits intomainfrom
cms-home-springboard

Conversation

@wen-2018
Copy link
Collaborator

If this changeset needs to go into the FXC codebase, please add the WMO and FXC label.

One-line summary

This PR adds CMS blocks for homepage media springboard section.

Significant changes and points to review

Issue / Bugzilla link

WT-659

Testing

  1. http://localhost:8000/cms-admin/
  2. add new homepage with home-2026 slug
  3. add spinrgboard section data using what is currently on https://www.mozilla.org/en-US/
  4. review content, seciton id, classes, link attributes etc on http://localhost:8000/en-US/home-2026/
  5. confirm tests logic and coverage

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.51%. Comparing base (ac2a557) to head (01194ab).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17030      +/-   ##
==========================================
+ Coverage   81.42%   81.51%   +0.09%     
==========================================
  Files         171      172       +1     
  Lines        9140     9188      +48     
==========================================
+ Hits         7442     7490      +48     
  Misses       1698     1698              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wen-2018 wen-2018 force-pushed the cms-home-springboard branch from 9b75e4e to 9bbce98 Compare February 11, 2026 19:52
@wen-2018 wen-2018 changed the title Cms home springboard Cms home springboard - WT-659 Feb 11, 2026
@wen-2018 wen-2018 marked this pull request as ready for review February 11, 2026 20:49
@wen-2018 wen-2018 requested review from a team as code owners February 11, 2026 20:49
@wen-2018 wen-2018 force-pushed the cms-home-springboard branch from e9a7976 to 6ad83e7 Compare February 11, 2026 21:02
@stevejalim stevejalim requested a review from Copilot February 12, 2026 13:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new CMS-managed “media springboard” block for the homepage, moving the previously hardcoded springboard include into CMS content blocks.

Changes:

  • Introduces SpringboardBlock / SpringboardItemBlock (plus settings) and wires it into HomePage StreamField.
  • Adds a new CMS block template for rendering the springboard section.
  • Adds fixtures, factories, and tests to validate springboard rendering and behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
bedrock/mozorg/blocks/common.py Adds Springboard blocks and tweaks existing block icons.
bedrock/mozorg/models.py Registers springboard_block on HomePage StreamField.
bedrock/mozorg/migrations/0025_alter_homepage_content.py StreamField migration to include springboard block.
bedrock/mozorg/templates/mozorg/cms/blocks/springboard_block.html New template for CMS-rendered springboard section.
bedrock/base/templates/macros-m24.html Updates springboard_item macro to mark link attributes as safe.
bedrock/mozorg/templates/mozorg/cms/home/home.html Removes hardcoded media-springboard include (now expected via CMS).
bedrock/mozorg/templates/mozorg/home/includes/m24/media-springboard.html Removes unused macro import.
bedrock/mozorg/fixtures/springboard_fixtures.py Adds fixtures to generate springboard variants and a test page.
bedrock/mozorg/tests/factories.py Adds Wagtail factories for springboard blocks/items.
bedrock/mozorg/tests/test_blocks.py Adds test coverage for springboard rendering/content/attributes.

Comment on lines +408 to +414
for variant in variants:
anchor_id = variant["value"].get("settings", {}).get("anchor_id")
if anchor_id:
# Find section by anchor ID
section = soup.find("section", id=anchor_id)
assert section is not None, f"Section with id '{anchor_id}' not found"
assert_springboard_block_attributes(section, variant)
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test only asserts the positive case (anchor_id present). Since assert_springboard_block_attributes also defines expectations for the empty-anchor case, add an assertion for variants where anchor_id is empty to verify the section does not render an id attribute (or otherwise validate the expected behavior).

Copilot uses AI. Check for mistakes.

# Check if test page already exists
test_page = HomePage.objects.filter(slug="springboard-block-test").first()
if test_page:
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an existing page without updating its content can make tests brittle when fixture variants change (stale DB state means tests may not reflect the current variant set). Consider overwriting test_page.content with the latest variants (and republishing), or deleting/recreating the page deterministically so test data is always in sync.

Suggested change
if test_page:
if test_page:
# Ensure existing test page content stays in sync with current variants
test_page.content = variants
test_page.save_revision().publish()

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@stevejalim stevejalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking very promising @wen-2018 - thanks for this!

I've added some comments and also expanded some of the thing Copilot talks about - take a look and see what you think. Happy to re-review one the tweaks are done.

Also, am I right that this page isn't used at all in prod yet (not even Stephanie's earlier cut)? If so, we'll have to plan and practise a rollout, because swapping the homepage of a Wagtail site isn't always straightforward

choices=[
("Article", "Article"),
("Podcast", "Podcast"),
("Video", "Video"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values and they keys here all start with a capital letter (Video) whereas below, for the icon field, they are lowercase keys. Can we make it consistent? The Django convention is lowercase keys with underscores for spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lower case for icon fields are used to set the CSS class for different custom icons. The Capitals for topic and type here are used as string options displayed on the page directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only display the second item / the valye in the page, not the first / the key - is that easy to make happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it accepts a single value. They must come it key - value tuples. https://docs.djangoproject.com/en/6.0/ref/models/fields/#choices

@wen-2018 wen-2018 force-pushed the cms-home-springboard branch from efbc417 to 508c9dd Compare February 12, 2026 18:38
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was removed (changed, renamed, and relocated) in a different PR, likely by mistake. Adding it back in.

@wen-2018
Copy link
Collaborator Author

wen-2018 commented Feb 12, 2026

@stevejalim

Also, am I right that this page isn't used at all in prod yet (not even Stephanie's earlier cut)? If so, we'll have to plan and practise a rollout, because swapping the homepage of a Wagtail site isn't always straightforward

That's correct! This page is not used in prod yet. There is one more section (showcase section, currently with state of Mozilla as the content) to be added in CMS. The hero and prod section are not planned to be added in CMS since they rarely change. Once this PR and the PR for showcase section are merged, we could plan out how the switch works:

  • build the page with actual content in prod
  • switch to use this new page
  • remove hard coded page
  • train admin users that needs to change the content for this page

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