You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cl...@apache.org on 2018/01/13 17:32:48 UTC

[whimsy] branch master updated: Fix focus on vote comment; add debug to url

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

clr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new ccf3740  Fix focus on vote comment; add debug to url
ccf3740 is described below

commit ccf3740274d508c543e95f6358d96e7a9e5836b3
Author: Craig L Russell <cr...@oracle.com>
AuthorDate: Sat Jan 13 09:32:36 2018 -0800

    Fix focus on vote comment; add debug to url
---
 www/project/icla/main.rb                |  2 ++
 www/project/icla/views/app.html.rb      |  2 +-
 www/project/icla/views/pages/vote.js.rb | 33 +++++++++++++++------------------
 3 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index 2f171c4..8dcbee8 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -71,6 +71,7 @@ get '/discuss' do
 
   # server data sent to client
   @token = params['token']
+  @debug = params['debug']
 
   # not needed for this form but required for other forms
   @pmcs = []
@@ -103,6 +104,7 @@ get '/vote' do
 
   # server data sent to client
   @token = params['token']
+  @debug = params['debug']
 
   # not needed for this form but required for other forms
   @pmcs = []
diff --git a/www/project/icla/views/app.html.rb b/www/project/icla/views/app.html.rb
index fe6a366..c43e027 100755
--- a/www/project/icla/views/app.html.rb
+++ b/www/project/icla/views/app.html.rb
@@ -376,7 +376,7 @@ _html lang: 'en', _width: '80' do
       _Main data: {pmcs: @pmcs, ppmcs: @ppmcs, pmc_mail: @pmc_mail,
         token: @token, contributor: @contributor, comments: @comments,
         user: @user, subject: @subject, phase: @phase, votes: @votes,
-        proposer: @proposer},
+        proposer: @proposer, debug: @debug},
         view: @view
     end
   end
diff --git a/www/project/icla/views/pages/vote.js.rb b/www/project/icla/views/pages/vote.js.rb
index bd52771..51ae47b 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -16,9 +16,8 @@ class Vote < Vue
     @timestamp = ''
     @commentBody = ''
     @subject = Server.data.subject
-    @showComment = true;
-    @debug = false;
-
+    @showComment = false;
+    @debug = Server.data.debug
   end
 
   def render
@@ -96,26 +95,20 @@ class Vote < Vue
       _p 'vote: ' + @vote
     end
 
-
     #
-    # Submission button
+    # Submission buttons
     #
-
     _p do
       _button.btn.btn_primary 'Submit my vote', disabled: @disabled,
         onClick: self.submitVote
       _b ' or '
-      _button.btn.btn_primary 'Cancel the vote', disabled: @disabled,
+      _button.btn.btn_primary 'Cancel the vote', disabled: false,
         onClick: self.cancelVote
       _b ' or '
-      _button.btn.btn_primary 'Tally the vote', disabled: @disabled,
+      _button.btn.btn_primary 'Tally the vote', disabled: false,
         onClick: self.tallyVote
     end
 
-
-
-
-
     #
     # Hidden form: preview invite email
     #
@@ -157,13 +150,15 @@ class Vote < Vue
         end
       end
     end
+  end
 
-
+  # when the form is redisplayed, e.g. after displaying/hiding the commentBody
+  def updated()
+    focusComment()
   end
 
-  # when the form is initially loaded, set the focus on the iclaname field
+  # when the form is initially loaded
   def mounted()
-    document.getElementById('commentBody').focus()
   end
 
   #
@@ -174,7 +169,10 @@ class Vote < Vue
     checkValidity()
   end
 
-
+  def focusComment()
+    f = document.getElementById('commentBody')
+    f.focus() if f
+  end
 
   #
   # validation and processing
@@ -182,11 +180,10 @@ class Vote < Vue
 
   # client side field validations
   def checkValidity()
-    # no vote or vote -1 without comment
+    # disabled if no vote or vote -1 without comment
     @disabled = (@vote == '' or (@vote == '-1' and @commentBody.empty?))
   end
 
-
   # server side field validations
   def previewInvitation()
     data = {

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