Ability to both open documents inline as well as download them
#241 opened on Jun 24, 2017
Description
Good day,
I was thinking that it would be nice to have the option to both view documents inline as well as download them. Currently, when you click a thumbnail in the overview it will always trigger a download. Often I just want to look at something though and avoid the download. Switching this to inline viewing can be done with the content-disposition as below:
diff --git a/src/documents/views.py b/src/documents/views.py
index b57a0a5..b749973 100644
--- a/src/documents/views.py
+++ b/src/documents/views.py
@@ -68,7 +68,7 @@ class FetchView(SessionOrBasicAuthMixin, DetailView):
GnuPG.decrypted(self.object.source_file),
content_type=content_types[self.object.file_type]
)
- response["Content-Disposition"] = 'attachment; filename="{}"'.format(
+ response["Content-Disposition"] = 'inline; filename="{}"'.format(
self.object.file_name)
return response
This in itself does not seem like a great solution though as the code overall refers to this as the download url and I think it makes sense to be a download url.
One option that came to my mind was on mouse-over on a thumbnail to have two buttons, one for download and one for viewing. Similar to what gmail does with attachments [0].
I'm happy to do a bit of tinkering around but I'm not quite sure where the actual layout of the document list is defined.
Any thoughts? :)
[0]