-
Notifications
You must be signed in to change notification settings - Fork 955
Add CMS-managed HomePage and Donate block #16991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
bedrock/cms/models/images.py
Outdated
| # 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
6d2fab5 to
6532305
Compare
There was a problem hiding this 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}" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
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.
| label_format = "Background: {background_color} - ID: {anchor_id}" | |
| label_format = "Background: {background_color}" |
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.
6532305 to
4a92e66
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
8a7d106 to
f9199fd
Compare
f9199fd to
51d3fc0
Compare
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:
Note: This page exists alongside the current homepage. URL routing migration will be handled separately.
Issue / Bugzilla link
WT-547
#16980
Testing