I like the integration part. But why the renaming?
"Add an attachment", for instance, sounds much more intuitive than "add a Download to the document".
What don't we like about "attachments"? Where is it missleading?
I like te integration with Metadata, because Attachments are now hidden inside that tab.
Also I will keep calling them Attachments, because they are documents attached to the main one. We just can interact downloading them right now, but I can imagine a future with photos or videos attached to the main document and users will consume them with preview methods, without downloading them.
We should review this issue together with one that is currently on sprint: https://github.com/huridocs/uwazi/issues/1026
What do you think @txau?
I think we have to rename it to downloads. I don't care about the possible future scenarios. We don't need to mix this with #1026, they are quite different actually.
This is a preview of what our current Attachments tab should be. I think it is a huge improvement in how users interact with this content, adding a lot of interesting information inside Metadata!

And it will look beautiful also on entities:

Looks great. A couple of comments:
I'm not sure about the download counter. I'm my opinion is a nth on cards, completely a must on our future dashboard for admins, so I would keep the idea and decide in the future if we want to implement it together with other stats.
About the boxes, I made them inside boxes because the properties are already separated by a grey line, so it feels weird to have the same separation for properties and for attachments. What do you think?

I would remove the number and use a different style for the Downloads title, separating sections.
Updated. I think it looks great in documents. I kept the boxes on entities, but we can remove them too and display each download in one row (just remove a couple of CSS properties).
It's working fully functional on 1146-downloads-metadata, but we should make QA and also modify all the E2E tests to this new layout.


@danicatalan LGTM
As discussed during the sprint planning today:
Musts:
Nice to have:
Related to #1171
@danicatalan check @RafaPolit comments please. You need to update the design.
@danicatalan @txau We also need a 'blank statement': what happens when there is no downloads?
If the button is in the section, then we need to keep it and say: no downloads. If the button is global, then should we not show downloads? Still a blank statement?
I have added the file size and moved the add button. What do you guys think?


I think it is clearer and since we already have that same functionality in mutlidate fields, it makes sense to repeat the behavior.
@danicatalan I have created all the new styles described above, and fixed all the E2E tests. This is ready to merge and waiting a PR.
If you want to try out things, please delete local branch and pull new one as it already has been rebased with dev.
@RafaPolit we should hide the Downloads title if there's no downloads, just like a normal property. We can show the title and the button to add the first file if the user is admin or editor.
I like the button below the attachments. I updated the branch to fix some styling issues with sizes and paddings, so for me it's ready to deploy.
@danicatalan @RafaPolit please don't forget to add the "Downloads" label to the translations.
@txau Its already there. We have a new system that if you are translating something that isnt on the translations, you get a test error. Its much harder to miss those now!
This is all finished and ready to merge. There was one important addition: we are now allowing updating, editing and deleting Downloads from within the Library and Uploads section directly, without needing to go inside the actual Document or Entity.
I think it makes for a much straightforward approach, and it fully integrates the downloads into the metadata, as the metadata is fully editable from the library.
Most helpful comment
This is all finished and ready to merge. There was one important addition: we are now allowing updating, editing and deleting Downloads from within the Library and Uploads section directly, without needing to go inside the actual Document or Entity.
I think it makes for a much straightforward approach, and it fully integrates the downloads into the metadata, as the metadata is fully editable from the library.