This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  85c3fe8   add a cancel button
85c3fe8 is described below

commit 85c3fe8ae102c9df1771f0fe476e37ba6970d89c
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Tue Sep 20 15:15:16 2016 -0400

    add a cancel button
---
 www/secmail/public/secmail.css      |  2 +-
 www/secmail/public/tasklist.js      | 20 ++++++++++++++++----
 www/secmail/views/forms/ccla.js.rb  |  3 ++-
 www/secmail/views/forms/grant.js.rb |  2 +-
 www/secmail/views/forms/icla.js.rb  |  2 +-
 www/secmail/views/tasklist.html.rb  | 10 ++++++++--
 6 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/www/secmail/public/secmail.css b/www/secmail/public/secmail.css
index 3b93e3f..a8ab8c2 100644
--- a/www/secmail/public/secmail.css
+++ b/www/secmail/public/secmail.css
@@ -80,7 +80,7 @@ form .btn {
   width: 100%
 }
 
-#parts div.buttons {
+div.buttons {
   text-align: center;
   margin: 1em 0;
 }
diff --git a/www/secmail/public/tasklist.js b/www/secmail/public/tasklist.js
index 1674f29..bcaecae 100644
--- a/www/secmail/public/tasklist.js
+++ b/www/secmail/public/tasklist.js
@@ -78,31 +78,43 @@ function nexttask(proceed) {
     if (!proceed) {
       $('h1').removeClass('bg-info').addClass('bg-danger').
         text('Processing Aborted');
-      message = {status: 'aborted'}
+      message = {status: 'aborted'};
       $('button').text('resume').prop('disabled', false);
     } else {
       $('h1').removeClass('bg-info').addClass('bg-success').
         text('Processing Complete');
       $('button').html('return to<br>mail index').prop('disabled', false);
-      message = {status: 'complete'}
+      message = {status: 'complete'};
     }
 
     window.parent.frames[0].postMessage(message, '*')
   }
 };
 
-// start the process when the button is clicked
-$('button').click(function(event) {
+// start the process when the proceed button is clicked
+$('button#proceed').click(function(event) {
   if (tasks.length) {
     $('h1').removeClass('bg-warning').addClass('bg-info').
       text('Request Status');
     $(this).prop('disabled', true);
+    $('button#cancel').prop('disabled', true);
     nexttask(true);
   } else {
     window.parent.location.href = '..';
   }
 });
 
+// end the process when the cancel button is clicked
+$('button#cancel').click(function(event) {
+  $(this).prop('disabled', true);
+  $('button#proceed').prop('disabled', true);
+  message = {status: 'cancelled'};
+  window.parent.frames[0].postMessage(message, '*');
+  $('ul')[0].style.opacity = '0.5';
+  $('h1').removeClass('bg-info').addClass('bg-danger').
+    text('Operation canceled');
+});
+
 // have delete and up keys return to index
 $(document).on('keypress', function(event) {
   if (event.keyCode == 8 || event.keyCode == 46) { // backspace or delete
diff --git a/www/secmail/views/forms/ccla.js.rb 
b/www/secmail/views/forms/ccla.js.rb
index 76bb578..1fdc2cd 100644
--- a/www/secmail/views/forms/ccla.js.rb
+++ b/www/secmail/views/forms/ccla.js.rb
@@ -8,7 +8,8 @@ class CCLA < React
     _h4 'CCLA'
 
     _div.buttons do
-      _button 'clear form', onClick: -> {@contact = @email = ''}
+      _button 'clear form', disabled: @filed,
+        onClick: -> {@contact = @email = ''}
     end
 
     _form method: 'post', action: '../../tasklist/ccla', target: 'content' do
diff --git a/www/secmail/views/forms/grant.js.rb 
b/www/secmail/views/forms/grant.js.rb
index 56bbc41..05f119c 100644
--- a/www/secmail/views/forms/grant.js.rb
+++ b/www/secmail/views/forms/grant.js.rb
@@ -8,7 +8,7 @@ class Grant < React
     _h4 'Grant'
 
     _div.buttons do
-      _button 'clear form', onClick: -> {@name = @email = ''}
+      _button 'clear form', disabled: @filed, onClick: -> {@name = @email = ''}
     end
 
     _form method: 'post', action: '../../tasklist/grant', target: 'content' do
diff --git a/www/secmail/views/forms/icla.js.rb 
b/www/secmail/views/forms/icla.js.rb
index 2ad5d2d..35ff6cb 100644
--- a/www/secmail/views/forms/icla.js.rb
+++ b/www/secmail/views/forms/icla.js.rb
@@ -9,7 +9,7 @@ class ICLA < React
     _h4 'ICLA'
 
     _div.buttons do
-      _button 'clear form', 
+      _button 'clear form', disabled: @filed,
         onClick: -> {@pubname = @realname = @email = @filename = ''}
     end
 
diff --git a/www/secmail/views/tasklist.html.rb 
b/www/secmail/views/tasklist.html.rb
index 89e0227..5c8e4fb 100644
--- a/www/secmail/views/tasklist.html.rb
+++ b/www/secmail/views/tasklist.html.rb
@@ -33,14 +33,20 @@ _html do
         _span @dryrun['warn']
        end
 
-      _button.btn.btn_danger 'proceed'
+      _div.buttons do
+        _button.btn.btn_danger.proceed! 'proceed anyway'
+        _button.btn.btn_warning.cancel! 'cancel', disabled: true
+      end
 
       _script %{
         var message = {status: 'warning'}
         window.parent.frames[0].postMessage(message, '*')
       }
     else
-      _button.btn.btn_primary 'proceed'
+      _div.buttons do
+        _button.btn.btn_primary.proceed! 'proceed'
+        _button.btn.btn_warning.cancel! 'cancel'
+      end
     end
 
     _script "var params = #{JSON.generate(params)};"

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Reply via email to