Show exit pages#1261
Merged
thomasiles merged 4 commits intomainfrom Mar 17, 2025
Merged
Conversation
lfdebrux
approved these changes
Mar 17, 2025
Contributor
lfdebrux
left a comment
There was a problem hiding this comment.
This is great, really clear breakdown of the commits and helpful commit messages. I've tested locally, it works for me.
7ecc4ac to
be64c81
Compare
To show exit pages to form fillers we need to add a route, controller and view. Exit pages are represented by conditions with exit_page_markdown set. For the route, we use the page slug and add /exit to the URL. This works because pages can only have one exit page at the moment. We might need to add condition id or make other changes when pages can have more than one exit page or when the exit page is the secondary route. The exit page controller inherits from page because it uses the current form, mode and step. We also redirect users back when they cannot view the current step because they haven't completed the form. The exit page is accessible as soon as the user can view the question step, regardless of the answer to the selection question.
Add two helpers which help us identify when a step has a condition which leads to an exit page.
Exit pages do not route on to other questions in the form when the condition is met. To represent this, Step#next_page_slug_after_routing returns nil when the page matches. This allows the journey code to stop looking for the next page and return. Exit page conditions already have a goto_page_id set to nil, so we could let this value be passed on more implicitly. Handling the case early clearly shows our intention. Exit_pages don't go to another page when they have been selected.
Add a feature test for the basic journey of visiting an exit page, pressing back and changing the answer to complete the form.
be64c81 to
b17b892
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Add support for exit pages within the runner
Trello card: https://trello.com/c/pfNYulxC/2151-add-support-for-exit-pages-to-forms-runner
Exit pages are given a url like this: "/preview-live/3/branch-route-form/11/exit". "/exit" is added on to the end of the page_slug.
We can change exit to anything else easily, I'll post something in slack and we make the change in another PR. It's just changing the route definition, so shouldn't be hard.
This PR doesn't add events when an exit page is viewed. I'll create another card which captures that so we can discuss what's best with Anne.
Note: I mucked up the markdown in the API seed for the exit pages. The above will only show correctly in the preview when the PR for fixing the seed is merged into the API.
Things to consider when reviewing