akshatpradhan/compliance_chimp — pull request #52 by adamico (2014-03-27 20:28:46+00:00)
Title: destroy filepicker images for unsaved proofs

I admit this is a bit hacky and it doesn't catch all edge cases. How does this works?

When a user clicks on the "Cancel" button in the proof form a modal opens (phrase and button text needs to be rephrased, I think) with a question asking if he really wants to lose changes to the proof. If he clicks on the green "No" button the modal gets closed and the user can choose to submit the form; if he clicks on the red "Yes" button a remote HTTP delete is issued to filepicker which deletes the newly updated image and the user is redirected to requirements#index.

This works for a new proof as well as for an existing proof.

I see at least 2 edge cases:

1. A user goes back with browser button
2. A user uploads another image (maybe we could disable the "Pick File" button after the first image upload)