Files
odoo_source/addons/website/static
Soukéina Bojabza fdfd5042f8 [IMP] website: manage better the files uploaded in a form
Before this commit, now that multiple files can be uploaded in a form,
we could observe that the file input is not convenient to manage this
situation:

- Clicking again on the input to choose other files replaces the
previously uploaded ones, we can therefore not upload files one by one.
- A file cannot be deleted in an obvious way: we need to cancel a new
upload, as it will replace the file by nothing and therefore delete it.
- When multiple files are uploaded, only the number of files is
displayed and not their name (they are only displayed on hover).

This commit improves these behaviors:

- Clicking again on the input adds additional files instead of replacing
them (unless the number of files allowed is 1);
- The button text content is modified after the upload of files,
displaying "Add Files"/"Replace File" (if multiple/single files are
allowed) to show its role better.
- When files are uploaded, blocks containing each files name and a
cross to delete them are displayed.

In order to make these improvements, the file input is hidden and
replaced by an input of type=`button` when files are uploaded. This was
done for two reasons:
- It is not possible to modify the content of an input of type=`file`
but we can change the value of a button.
- The input did not look good with the file blocks, because it has a
text displaying file informations, which was redundant with the blocks.

task-2798576

Part-of: odoo/odoo#89055
2023-05-15 12:55:58 +02:00
..