We’d like to allow students to delete individual files from the list of their uploaded (but not submitted) files in an ORA2 XBlock.
In the UI: put an 'x' button next to each file description. Clicking this button should start the file deletion process. It should create an alert box that asks the user to confirm their intention to delete the selected file.
This probably needs an aria-describedby (or similar) for a11y reasons. Confirm with Jeff W.
In the SubmissionMixinclass, add a new method/endpoint called remove_file_by_key that, given a file key, deletes the file file storage backend. It should return a dictionary with a success key that’s True when the file was actually deleted, and False otherwise. See:
On the JS side:
We need a function in os_server.js similar to removeUploadedFiles that calls the endpoint exposed in the step above with a single argument - the file key to delete. See:
On success, the UI should remove the deleted file from the list of uploaded file descriptions.
On failure, put a message in a red banner explaining that no file was deleted. Use the banner that indicates you’ve gone over the file size limit for inspiration. Possibly, you just want to use toggleActionError method to render this. See:
Feature-gating: None, this should be a general ORA2 improvement that is accessible to all courses and students.