diff --git a/HISTORY.rst b/HISTORY.rst index aea00e8a61..a61fdd6a1e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -78,6 +78,8 @@ Support Docker networks and make it the default. Delete the containers to allow the script to be idempotent. Deploy a Redis container. +- Improve document version upload form. +- Use dropzone for document version upload form. 3.2.8 (2019-10-01) ================== diff --git a/mayan/apps/sources/templates/sources/dropzone.html b/mayan/apps/sources/templates/sources/dropzone.html new file mode 100644 index 0000000000..9f2118eb62 --- /dev/null +++ b/mayan/apps/sources/templates/sources/dropzone.html @@ -0,0 +1,115 @@ +{% load i18n %} +{% load static %} + + + + + + + + diff --git a/mayan/apps/sources/templates/sources/upload_multiform_subtemplate.html b/mayan/apps/sources/templates/sources/upload_multiform_subtemplate.html index 573aeee391..100f5ae9c8 100644 --- a/mayan/apps/sources/templates/sources/upload_multiform_subtemplate.html +++ b/mayan/apps/sources/templates/sources/upload_multiform_subtemplate.html @@ -1,118 +1,2 @@ -{% load i18n %} -{% load static %} - - - - - {% include 'appearance/generic_multiform_subtemplate.html' %} - - - - - +{% include 'sources/dropzone.html' %} diff --git a/mayan/apps/sources/views.py b/mayan/apps/sources/views.py index 782a4779c8..d0d98cd3c9 100644 --- a/mayan/apps/sources/views.py +++ b/mayan/apps/sources/views.py @@ -453,9 +453,15 @@ class DocumentVersionUploadInteractiveView(UploadBaseView): ) def get_form_classes(self): + source_form_class = get_upload_form_class(self.source.source_type) + + # Override source form class to enable the HTML5 file uploader + if source_form_class == WebFormUploadForm: + source_form_class = WebFormUploadFormHTML5 + return { 'document_form': NewVersionForm, - 'source_form': get_upload_form_class(self.source.source_type) + 'source_form': source_form_class } def get_context_data(self, **kwargs): @@ -468,6 +474,14 @@ class DocumentVersionUploadInteractiveView(UploadBaseView): 'from source: %(source)s' ) % {'document': self.document, 'source': self.source.label} context['submit_label'] = _('Submit') + context['form_css_classes'] = 'dropzone' + context['form_disable_submit'] = True + context['form_action'] = '{}?{}'.format( + reverse( + viewname=self.request.resolver_match.view_name, + kwargs=self.request.resolver_match.kwargs + ), self.request.META['QUERY_STRING'] + ) return context