Skip to content

Create Image + Caption block - #1658

Merged
maribedran merged 5 commits into
mainfrom
image-caption-block
Aug 1, 2026
Merged

Create Image + Caption block#1658
maribedran merged 5 commits into
mainfrom
image-caption-block

Conversation

@maribedran

Copy link
Copy Markdown
Collaborator

One-line summary

Create a new block to support Image + Captions on blog articles.

Significant changes and points to review

Create the new component, CMS block, and corresponding pattern library entry and tests.

Issue / Bugzilla link

Part of the #1627

Testing

Run ./manage.py load_page_fixtures and check blog articles such as http://localhost:8000/en-US/flare-docs/sample-pages/test-blog-index/test-featured-blog-article-4/

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.91%. Comparing base (8712854) to head (1ff3579).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1658      +/-   ##
==========================================
+ Coverage   87.89%   87.91%   +0.01%     
==========================================
  Files         167      167              
  Lines       11421    11435      +14     
==========================================
+ Hits        10039    10053      +14     
  Misses       1382     1382              

☔ View full report in Codecov by Harness.
📢 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.

@maribedran
maribedran requested a review from Copilot July 31, 2026 18:15
@maribedran maribedran added the Needs Review Awaiting code review label Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 Wagtail StreamField block to support “Image + Caption” content in blog articles, with accompanying templates, styling, fixtures, and automated coverage (pytest + Playwright visual regression). This aligns with the WordPress import work in #1627 by expanding the set of supported article body blocks.

Changes:

  • Introduce ImageCaptionBlock and enable it in BlogArticlePage.body.
  • Add rendering templates + pattern-library component for Image + Caption, plus styling in Flare media/blog CSS.
  • Extend blog fixtures and tests (pytest block rendering assertions + Playwright visual regression coverage).

Reviewed changes

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

Show a summary per file
File Description
tests/playwright/specs/visual-regression/image-caption.spec.js Adds visual regression coverage for the new pattern-library component (light + dark).
springfield/cms/tests/test_blog_pages.py Updates fixture helper import/usage after renaming the blog article factory.
springfield/cms/tests/test_blocks.py Adds an integration-style test validating rendered <figure>/<figcaption> output and image variant attributes.
springfield/cms/templates/pattern-library/components/flare/media/image_caption.yaml Provides pattern-library demo context for the Image + Caption component.
springfield/cms/templates/pattern-library/components/flare/media/image_caption.html Adds pattern-library template wiring for the new component.
springfield/cms/templates/components/image-caption.html Implements the shared component markup (<figure> + <figcaption>).
springfield/cms/templates/cms/blocks/image-caption.html Implements the CMS block template (uses richtext + removes wrapping <p>).
springfield/cms/models/pages.py Registers image_caption as an available block type in BlogArticlePage.body.
springfield/cms/fixtures/blog_fixtures.py Adds caption fixture content and enables fixtures to produce captioned vs plain image content.
springfield/cms/blocks.py Defines the new ImageCaptionBlock (image variants + rich text caption).
media/css/cms/pages/flare-blog.css Adds blog-article-specific sizing for images rendered via the image variants utility.
media/css/cms/components/flare-media.css Adds component styling for .fl-image-caption and caption text.

@lucianoratamero lucianoratamero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good but take a look at the copilot comment, see if it makes sense

@lucianoratamero

Copy link
Copy Markdown
Collaborator

quick question: it's supposed to be square shaped, right?
this is what I'm getting:

CleanShot 2026-07-31 at 20 16 13

@maribedran

Copy link
Copy Markdown
Collaborator Author

@lucianoratamero for now yes. We can add an option to add a border radius at some point.

@maribedran
maribedran merged commit 027dd19 into main Aug 1, 2026
7 checks passed
@maribedran
maribedran deleted the image-caption-block branch August 1, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Awaiting code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants