Skip to content

Conversation

@stephaniehobson
Copy link
Contributor

One-line summary

Significant changes and points to review

Introduce Wagtail CMS support for the homepage, starting with the donate section. This creates the foundation for migrating homepage content to the CMS.

Changes:

  • Add HomePage model StreamField that has DonateBlock in it
  • Add DonateBlock with configurable background color and anchor ID
  • Add 2:1 aspect ratio fill specs for image renditions
  • Duplicate the rest of the m24 homepage content as static content for now

Note: This page exists alongside the current homepage. URL routing migration will be handled separately.

Issue / Bugzilla link

WT-547
#16980

Testing

# regenerate it, if needed, so that the image library is updated locally after
# downloading images from Dev, Stage or Prod
"max-165x165",
# 2:1 aspect ratio renditions for homepage donate block (and similar uses)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevejalim Could you please comment on this addition.

The idea is that I want to enforce the 2:1 aspect ratio of the image in this block but if this will add a lot of over head to keep doing this every time I want to enforce a ratio I can take the guardrails off and instead rely on communication with the users

Copy link
Contributor

@stevejalim stevejalim Jan 15, 2026

Choose a reason for hiding this comment

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

How often will we need to enforce a new ratio, and how many will there be? Could we just spec out all likely set now (2:1, 3:2, 16:9). Yes, it generates more files, but they are done in the background and don't show up in the Image picker.

One thing to notice is that unless we re-save every image in the CMS, these additional renditions will only be made for images added after the code goes live. That may be fine - if it's not we can add a data migration to trigger the generation of the additional rendition sizes - ping me if you'd like me to add that, np

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, there's a docstring below that will need amending (and some platform documentation) to mention the extra rendition specs we use

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renditions and docstring updated, but let me know if you'd rather I pulled them out into a separate PR.

Copy link
Contributor Author

@stephaniehobson stephaniehobson Jan 17, 2026

Choose a reason for hiding this comment

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

Companion docs updates: mozmeao/platform-docs#35

@stephaniehobson stephaniehobson force-pushed the wagtail-home branch 2 times, most recently from 6d2fab5 to 6532305 Compare January 15, 2026 20:21
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

This PR introduces Wagtail CMS support for the Mozilla homepage, specifically implementing a CMS-managed donate section. The changes lay the foundation for gradually migrating homepage content from static templates to the CMS while maintaining the existing homepage alongside.

Changes:

  • Added HomePage model with StreamField for donate section management
  • Created DonateBlock with configurable background colors and anchor IDs
  • Added 2:1 aspect ratio image renditions for responsive donate section images

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
media/css/m24/donate.scss Renamed CSS classes from donate-title/info to donate-heading/body for consistency
bedrock/mozorg/tests/test_blocks.py Added comprehensive tests for DonateBlock rendering, content, and attributes
bedrock/mozorg/tests/factories.py Added factory classes for DonateBlock and HomePage test creation
bedrock/mozorg/templates/mozorg/home/includes/m24/donate.html Refactored to use new m24_donate macro
bedrock/mozorg/templates/mozorg/cms/home/home.html New CMS-driven homepage template with donate section
bedrock/mozorg/templates/mozorg/cms/home/blocks/donate_block.html Template for rendering CMS-managed donate blocks
bedrock/mozorg/models.py Added HomePage model with donate StreamField
bedrock/mozorg/migrations/0022_homepage.py Database migration for HomePage model
bedrock/mozorg/fixtures/donate_fixtures.py Test fixtures for donate block variants
bedrock/mozorg/fixtures/base_fixtures.py Shared fixture utilities for test images and pages
bedrock/mozorg/fixtures/init.py Package initialization file
bedrock/mozorg/blocks/home.py DonateBlock and DonateBlockSettings definitions
bedrock/cms/models/images.py Added 2:1 aspect ratio image rendition specs
bedrock/cms/models/base.py Enhanced base page model to support page-specific FTL files
bedrock/base/templates/macros-m24.html Added m24_donate macro for reusable donate section rendering

icon = "cog"
collapsed = True
label = "Settings"
label_format = "Background: {background_color} - ID: {anchor_id}"
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Consider using conditional formatting to handle empty anchor_id values more gracefully. Currently, this will show "Background: gray - ID: " when no anchor is set, which includes unnecessary trailing text.

Suggested change
label_format = "Background: {background_color} - ID: {anchor_id}"
label_format = "Background: {background_color}"

Copilot uses AI. Check for mistakes.
Introduce Wagtail CMS support for the homepage, starting with the donate section. This creates the foundation for migrating homepage  content to the CMS.

Changes:
- Add HomePage model StreamField that has DonateBlock in it
- Add DonateBlock with configurable background color and anchor ID
- Add 2:1 aspect ratio fill specs for image renditions
- Duplicate the rest of the m24 homepage content as static content for now

Note: This page exists alongside the current homepage. URL routing migration will be handled separately.
@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 98.63014% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.22%. Comparing base (a96ae66) to head (51d3fc0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
bedrock/mozorg/fixtures/donate_fixtures.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16991      +/-   ##
==========================================
+ Coverage   81.08%   81.22%   +0.13%     
==========================================
  Files         157      160       +3     
  Lines        8313     8380      +67     
==========================================
+ Hits         6741     6807      +66     
- Misses       1572     1573       +1     

☔ 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.

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.

3 participants