deposit: non spaghetti code of the modal_preview

Signed-off-by: Georgios Kokosioulis <georgios.kokosioulis@cern.ch>