Skip to content
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

TWE-39 Add a new block for textual statistic groups #364

Open
wants to merge 1 commit into
base: integration/2024-evolution
Choose a base branch
from

Conversation

bmispelon
Copy link
Collaborator

@bmispelon bmispelon commented Feb 11, 2025

Link to Ticket

Description of Changes Made

I've created a new block type that's the textual counterpart of the numerical statistics block, and activated it for the division pages.

As suggested in the ticket, the HTML code for this new block was copy/pasted from the numerical stat block added in #328 (with the path to the template adapted).

How to Test

  1. Edit a division page (like wagtail-test)
  2. In the body, add a "Textual statistics" block
  3. Fill in the "title" and "intro" fields, and create one or more "Statistics"
  4. Publish the page, then observe that the newly added statistics block is visible

Screenshots

Expand to see more

Screenshot 2025-02-11 at 09-37-30 Editing Division page Wagtail - Wagtail

Screenshot 2025-02-11 at 09-36-45 Wagtail Torchbox

MR Checklist

  • Add a description of your pull request and instructions for the reviewer to verify your work.
  • If your pull request is for a specific ticket, link to it in the description.
  • Stay on point and keep it small so the merge request can be easily reviewed.
  • Tests and linting passes.

Unit tests

  • Added
  • Not required

Documentation

Browser testing

  • I have tested in the following browsers and environments (edit the list as required)
    • Latest version of Firefox on Linux
  • Not required

Data protection

  • Not relevant
  • This adds new sources of PII and documents it and modifies Birdbath processors accordingly

Light and dark mode

  • I have tested the changes in both light and dark mode
  • The change is not relevant to dark and light mode

Accessibility

  • Automated WCAG 2.1 tests pass
  • HTML validation passes
  • Manual WCAG 2.1 tests completed
  • I have tested in a screen reader
  • I have tested in high-contrast mode
  • Any animations removed for prefers-reduced-motion
  • Not required

Sustainability

  • Images are optimised and lazy-loading used where appropriate
  • SVGs have been optimised
  • Perfomance and transfer of data considered
  • If JavaScript is needed alternatives have been considered
  • Not required

Pattern library

  • The pattern library component for this template displays correctly, and does not break parent templates
  • The styleguide is updated if relevant
  • Changes are not relevant the pattern library

@bmispelon bmispelon force-pushed the feature/twe-39-text-statistics-block branch from 0c3424d to 53d5378 Compare February 11, 2025 08:45
@bmispelon bmispelon marked this pull request as ready for review February 11, 2025 08:52
Copy link
Collaborator

@SharmaineLim SharmaineLim left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks a lot, Baptiste!

Screenshots

image

image

@@ -1050,11 +1050,21 @@ class Meta:
label_format = "{headline_number} {description} {further_details}"


class NumericStatisticsGroupBlock(blocks.StructBlock):
class AbstractStatisticsGroupBlock(blocks.StructBlock):
Copy link
Collaborator

@SharmaineLim SharmaineLim Feb 20, 2025

Choose a reason for hiding this comment

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

(nitpick) I feel like this could be shared by more blocks since an optional title and intro is pretty common, but for now this is fine. :)

{% load wagtailcore_tags wagtailimages_tags %}
<div class="grid__stats-group stats-group">
{% if value.title %}
{% include "patterns/atoms/motif-heading/motif-heading.html" with heading_level=2 heading=value.title classes="motif-heading motif-heading--two-c motif-heading--static stats-group__heading" %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we've removed the motif-heading.html file, so we may need to update this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, good catch 👍🏻

@bmispelon bmispelon force-pushed the feature/twe-39-text-statistics-block branch from 53d5378 to 875c34b Compare February 20, 2025 13:06
@bmispelon
Copy link
Collaborator Author

Thanks for the review @SharmaineLim !
I've removed the inclusion of motif-heading.html and used the same template code as in numeric_stats_group_block.html 👍🏻

I also took the liberty to rebase this branch on the latest version of integration/2024-evolution and force-pushed, I hope that's OK.

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