From 57dd5b1bcaf6b0354232b520dce53ded16215cea Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 10 Oct 2019 17:15:45 -0400 Subject: [PATCH 1/3] Split source multiform template Signed-off-by: Roberto Rosario --- .../sources/templates/sources/dropzone.html | 115 +++++++++++++++++ .../sources/upload_multiform_subtemplate.html | 118 +----------------- 2 files changed, 116 insertions(+), 117 deletions(-) create mode 100644 mayan/apps/sources/templates/sources/dropzone.html 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' %} From fc14341d4039be2baf619416eddba689f0074957 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 10 Oct 2019 17:16:16 -0400 Subject: [PATCH 2/3] Update document version upload to use dropzone Signed-off-by: Roberto Rosario --- mayan/apps/sources/views.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mayan/apps/sources/views.py b/mayan/apps/sources/views.py index 4e24c01be3..8085143921 100644 --- a/mayan/apps/sources/views.py +++ b/mayan/apps/sources/views.py @@ -449,9 +449,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): @@ -464,6 +470,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 From b2390843abfa03e56ae677d9a8b85d33598f8b87 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 10 Oct 2019 17:18:39 -0400 Subject: [PATCH 3/3] Update changelog Signed-off-by: Roberto Rosario --- HISTORY.rst | 2 ++ 1 file changed, 2 insertions(+) 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) ==================