From 3a5a4db78eaa207ccbf8c929c50d48bc4bb297cc Mon Sep 17 00:00:00 2001 From: cc-cpo Date: Fri, 19 May 2017 17:15:48 +0200 Subject: [PATCH 1/5] add unconfigured blockUI --- build.gradle | 1 + src/main/resources/static/js/app.js | 6 ++++++ src/main/resources/templates/layout.html | 1 + 3 files changed, 8 insertions(+) diff --git a/build.gradle b/build.gradle index 427b566..b1a3ff5 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,7 @@ dependencies { compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.8') compile('org.webjars:bootstrap:3.3.7-1') compile('org.webjars:jquery:3.2.0') + compile('org.webjars:jquery-blockui:2.65') compile('org.webjars:clipboard.js:1.6.1') compile('org.webjars.bower:pwstrength-bootstrap:2.0.3') compile('org.webjars.bower:bootstrap-maxlength:1.7.0') diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index 90eef28..383a5bb 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -27,4 +27,10 @@ $(function () { setTooltip(e.trigger, 'Failed!'); hideTooltip(e.trigger); }); + + $(document).on('submit', 'form', function(event) { + $.blockUI({ overlayCSS: { backgroundColor: '#00f' } }); + setTimeout($.unblockUI, 2000); + }); + }); diff --git a/src/main/resources/templates/layout.html b/src/main/resources/templates/layout.html index 9a671db..2eab3f2 100644 --- a/src/main/resources/templates/layout.html +++ b/src/main/resources/templates/layout.html @@ -18,6 +18,7 @@ + From 8a4a8c71be8c8f1bc9c22cacb8e0c560689a4e3e Mon Sep 17 00:00:00 2001 From: cc-cpo Date: Fri, 19 May 2017 17:36:35 +0200 Subject: [PATCH 2/5] click to abort --- src/main/resources/static/js/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index 383a5bb..f3183d2 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -29,8 +29,16 @@ $(function () { }); $(document).on('submit', 'form', function(event) { - $.blockUI({ overlayCSS: { backgroundColor: '#00f' } }); - setTimeout($.unblockUI, 2000); + var abortSend = function() { + $.unblockUI(); + history.go(0); // reset page + }; + $.blockUI({ + message: 'Please wait .. click to ABORT', + overlayCSS: { backgroundColor: '#00f' }, + onOverlayClick: abortSend + }); + setTimeout($.unblockUI, 10000); }); }); From 014cc6d407d661ce560e65d2f5659778864cdbef Mon Sep 17 00:00:00 2001 From: cc-cpo Date: Fri, 19 May 2017 17:39:07 +0200 Subject: [PATCH 3/5] fix blockUI z-index --- src/main/resources/static/js/app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index f3183d2..054d7cd 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -28,6 +28,9 @@ $(function () { hideTooltip(e.trigger); }); + // must be greater than z-index of maxlength indicator + $.blockUI.defaults.baseZ = 2000; + $(document).on('submit', 'form', function(event) { var abortSend = function() { $.unblockUI(); From b35ab3f6973f01d5f6414bdefd37f756690e76e2 Mon Sep 17 00:00:00 2001 From: cc-cpo Date: Fri, 19 May 2017 17:53:41 +0200 Subject: [PATCH 4/5] style blockUI --- src/main/resources/static/js/app.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index 054d7cd..d1ae925 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -30,18 +30,21 @@ $(function () { // must be greater than z-index of maxlength indicator $.blockUI.defaults.baseZ = 2000; + $.blockUI.defaults.css.border = '6px double #669966'; $(document).on('submit', 'form', function(event) { var abortSend = function() { $.unblockUI(); history.go(0); // reset page }; - $.blockUI({ - message: 'Please wait .. click to ABORT', - overlayCSS: { backgroundColor: '#00f' }, - onOverlayClick: abortSend + var block = function() { + $.blockUI({ + message: 'Please wait .. click to ABORT', + overlayCSS: { backgroundColor: '#99CC00' }, + onOverlayClick: abortSend }); - setTimeout($.unblockUI, 10000); + }; + setTimeout(block, 700); }); }); From 69524e626c2e85638f0def06ac09db8fbb7efda9 Mon Sep 17 00:00:00 2001 From: cc-cpo Date: Mon, 22 May 2017 07:53:14 +0200 Subject: [PATCH 5/5] declare block-on-submit behaviour via marker class --- src/main/resources/static/js/app.js | 2 +- src/main/resources/templates/send/send_form.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js index d1ae925..cde8775 100644 --- a/src/main/resources/static/js/app.js +++ b/src/main/resources/static/js/app.js @@ -32,7 +32,7 @@ $(function () { $.blockUI.defaults.baseZ = 2000; $.blockUI.defaults.css.border = '6px double #669966'; - $(document).on('submit', 'form', function(event) { + $('form.submit--blocking').submit(function(event) { var abortSend = function() { $.unblockUI(); history.go(0); // reset page diff --git a/src/main/resources/templates/send/send_form.html b/src/main/resources/templates/send/send_form.html index 9efc123..118e20e 100644 --- a/src/main/resources/templates/send/send_form.html +++ b/src/main/resources/templates/send/send_form.html @@ -29,7 +29,8 @@

Secure Transfer

Securely send your sensitive data.

-
+
Error processing your request