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

Play back what file has been uploaded to users, and allow them to change file #1160

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

stephencdaly
Copy link
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/mfhj3ufe/2068-play-back-what-file-has-been-uploaded-to-users-and-allow-them-to-change-file

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?
  • Has all relevant documentation been updated?

stephencdaly and others added 2 commits January 24, 2025 17:23
We will need to have the logic to check whether a file has been
uploaded for the question in multiple places, so adding a method for
code sharing.

Co-authored-by: Jamie Wilkinson <[email protected]>
Add a component containing the table to review the uploaded file name
along with a remove button for file upload questions. We're using a
component that inherits the Question::Base component as we need to use
the methods on this to render the question text heading and hint text,
if it's present.

Co-authored-by: Jamie Wilkinson <[email protected]>
@stephencdaly stephencdaly force-pushed the add-file-upload-preview-page branch 2 times, most recently from b1cddb6 to 5cd4cad Compare January 24, 2025 17:28
stephencdaly and others added 9 commits January 24, 2025 17:35
Add routes and page to review a file after it's been uploaded. This
page plays back the uploaded filename with a button to remove the
file. The continue button on the page posts to a route which will just
redirect to the next question. We do not need to save anything at this
point as the answer has already been saved.

The route to remove the file has been added, but we have not
added the implementation for this yet.

Co-authored-by: Jamie Wilkinson <[email protected]>
Add a method to the file question model to delete the file from S3.
This will be called when the remove button is clicked on the review
file page.
Implement the remove file route, which is POSTed to when the user
clicks the remove button on the file review page. This calls S3 to
delete the file and removes the answer from the session.

This does not take into account the the question having multiple
answers, as we do not currently support "add another answer" for file
upload questions. The logic to remove the answer from the session will
need to be modified if we want to support this in the future.

Co-authored-by: Jamie Wilkinson <[email protected]>
After saving the answer to a question, if the question is a file
upload question, and is not an optional question that has been
skipped, redirect to the new review file route.

We've added a new private method `save_redirect_path` for this logic,
as we use the `next_page` method in other subclasses of the
PageController, such as the ReviewFileController, and in these use
cases, we always want to go to the next step in the form.

Co-authored-by: Jamie Wilkinson <[email protected]>
If attempting to visit the page for a file upload question, redirect
to the review file page if the question has already been answered.
On this page, the user is shown the file that has already been
uploaded with the option to remove the file and then upload another
one.
Pass through the `changing_existing_answer` query parameter when
moving between pages when reviewing an changing the answer to a file
upload. This means that the user will get returned to the check your
answers page when they click "Continue" on the file review page after
they have made any changes they need to.
Display a success notification banner on a page if there is a
`success` flash message present on a request.
@stephencdaly stephencdaly force-pushed the add-file-upload-preview-page branch from 5cd4cad to 0764121 Compare January 24, 2025 17:35
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