Skip to content

Conversation

ChrisBAshton
Copy link
Contributor

@ChrisBAshton ChrisBAshton commented Jul 18, 2025

This is a spike, written to support the Google Doc Migrating a ‘standard’ document type to Flexible Pages.

Sister PR: alphagov/publishing-api#3465

Screenshots

Additional page types under the "flexible pages" option on the New Document workflow:

Screenshot 2025-07-18 at 16 38 02

Flexible form, with dynamic support for associations, and file-attachment-related 'accessible email address':

Support for attachments, lead images and translations (title currently "Not set", because we've only allowed configuration of the flexible-page-specific 'page title' rather than the 'admin title'. Will revisit this later):

Screenshot 2025-07-18 at 16 40 29

The translations form surfaces all the same flexible fields as the main edition form:

Screenshot 2025-07-18 at 16 40 47

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the Whitehall Experience team. Please let us know in #govuk-whitehall-experience-tech when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

This did trip me up for a minute or two!
We couldn't use the standard edition_translations_controller stuff
because we need to be translating the dynamic flexible fields,
not just title/summary/body.

The new flexible_pages_translations_controller solution works
rather well! Things to note:

- No support for "Original text for translated summary" details
  element, yet. We'd have to find a way of passing both the
  translation and the primary locale translation to the Flexible
  Page Content Block / default object tree.
- The Edition::Translatable concern literally isn't used anywhere
  in this code. So possibly a complexity we'll be able to simply
  delete once everything is migrated to flexible formats.
- Currently no way of changing primary locale. World News Stories
  currently have a "Foreign language only" option which allows the
  publisher to change the primary locale from English to something
  else - and for some reason, we then don't allow publishers to
  add translations of that content. It seems a bit of an arbitrary
  rule that adds complexity for little benefit.
Theory being, we can migrate existing standard edition types
inside Whitehall, to the new flexible pages format, *without*
Publishing API, Content Store and the Frontend being updated to
accommodate the change. Then, when all the folks downstream of
Whitehall are ready, switching to flexible page rendering would
be as simple as removing the `legacy_presenter` property from the
schema.

Spent an hour or two on this, it's a bit fiddly, but I'm sure it's
doable.
This reverts commit e91dcff.

^ Just so that we have something working locally, but don't lose
the code altogether.
@ChrisBAshton ChrisBAshton changed the title Spike using 'flexible page' architecture for NewsArticle document types Spike using 'flexible page' architecture for NewsArticle document types (WHIT-2324) Jul 21, 2025
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.

1 participant