Skip to content

Add exit pages#2880

Open
thomasiles wants to merge 10 commits into
mainfrom
add-exit-pages
Open

Add exit pages#2880
thomasiles wants to merge 10 commits into
mainfrom
add-exit-pages

Conversation

@thomasiles

@thomasiles thomasiles commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Add new ExitPage table and model

Trello card: https://trello.com/c/E1qseSQu/3163-add-model-for-exit-pages-to-forms-admin

This PR adds a new model for ExitPages. The model isn't used anywhere yet. The "exit_pages": [] entry will appear in formdocument's steps.

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

Add a new table, exit_pages, for the new ExitPage model.

ExitPages are always linked to a page and are deleted when the page is
deleted.
Add a model and factory for exit pages.

We also add basic validations to make sure the exit page has a heading and
markdown body.

No character limits have been set yet.
Page gets a new association for exit pages.

Each page can have multiple exit pages.
To support Welsh, ExitPages now have a translations table.

The heading and markdown attributes will have translations, matching the
current use of Conditions.
Add an optional association from Condition to ExitPage.
Change the exit_page? method on Conditions to check for an associated
ExitPage as a fallback to using exit_page_markdown.

This is to support the transition from the old exit_page_markdown
column to the new ExitPage model.
Exit pages will appear in the form document.

Because exit pages are tied to a question page, and a page can have
multiple exit pages, we add an array to Step in the form document.
If the answer type or number of selection options changes, delete any
existing ExitPages as well as any conditions associated with them.

We combine the conditions to make the code neater and wrap all the
database interactions in a transaction. This means they either all get
commited or none of them do.
@thomasiles thomasiles marked this pull request as ready for review July 1, 2026 14:48
Add the exit_page_id to the Condition FormDocument entry so that the
ExitPage can be referenced in the FormDocument.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2880.admin.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

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