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/30 23:38:15 UTC

[whimsy] branch master updated: project/icla add roughed-in vote processing

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 3be34db  project/icla add roughed-in vote processing
3be34db is described below

commit 3be34dbb54bb83ee72d9d77cc95b4ce993fb9246
Author: Craig L Russell <cr...@oracle.com>
AuthorDate: Tue Jan 30 15:38:06 2018 -0800

    project/icla add roughed-in vote processing
---
 www/project/icla/views/actions/discuss.json.rb     |  4 +-
 .../actions/{discuss.json.rb => vote.json.rb}      | 14 ++---
 www/project/icla/views/pages/invite.js.rb          | 72 ++++++++++++++++++----
 www/project/icla/views/pages/vote.js.rb            |  2 +-
 4 files changed, 70 insertions(+), 22 deletions(-)

diff --git a/www/project/icla/views/actions/discuss.json.rb b/www/project/icla/views/actions/discuss.json.rb
index 7d29024..333d1e1 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/discuss.json.rb
@@ -26,7 +26,7 @@ end
 # create the discussion object
 date = Time.now.to_date.to_s
 contributor = {:name => @iclaname, :email => @iclaemail}
-comment = @proposalText + '\n' + @discussComment
+comment = @proposalText + "\n" + @discussComment
 comments = [{:member => @proposer, :timestamp => date, :comment => comment}]
 discussion = {
   :phase => 'discuss',
@@ -59,7 +59,7 @@ link = "#{scheme}://#{env['HTTP_HOST']}#{path}"
 _token token
 _subject params['subject']
 _discussion discussion
-_message %{
+_message %{#{comment}
 Use this link to continue the discussion:
 
 #{link}
diff --git a/www/project/icla/views/actions/discuss.json.rb b/www/project/icla/views/actions/vote.json.rb
similarity index 85%
copy from www/project/icla/views/actions/discuss.json.rb
copy to www/project/icla/views/actions/vote.json.rb
index 7d29024..f1618af 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/vote.json.rb
@@ -23,18 +23,18 @@ rescue
   _error 'Invalid domain name in email address'
   _focus :iclaemail
 end
-# create the discussion object
+# create the vote object
 date = Time.now.to_date.to_s
 contributor = {:name => @iclaname, :email => @iclaemail}
-comment = @proposalText + '\n' + @discussComment
-comments = [{:member => @proposer, :timestamp => date, :comment => comment}]
+comment = @proposalText + "\n" + @voteComment
+votes = [{:vote =>'+1', :member => @proposer, :timestamp => date, :comment => comment}]
 discussion = {
-  :phase => 'discuss',
+  :phase => 'vote',
   :proposer => @proposer,
   :subject => @subject,
   :project => @pmc,
   :contributor => contributor,
-  :comments => comments
+  :votes => votes
 }
 
   # generate a token
@@ -59,8 +59,8 @@ link = "#{scheme}://#{env['HTTP_HOST']}#{path}"
 _token token
 _subject params['subject']
 _discussion discussion
-_message %{
-Use this link to continue the discussion:
+_message %{#{comment}
+Use this link to vote:
 
 #{link}
 }
diff --git a/www/project/icla/views/pages/invite.js.rb b/www/project/icla/views/pages/invite.js.rb
index 39e02bb..d357799 100644
--- a/www/project/icla/views/pages/invite.js.rb
+++ b/www/project/icla/views/pages/invite.js.rb
@@ -34,8 +34,9 @@ class Invite < Vue
     @showPhaseFrame = false;
     @showRoleFrame = false;
     @discussComment = ''
-    @voteBody = ''
+    @voteComment = ''
     @proposalText = ''
+    @voteProposalText = ''
   end
 
   def render
@@ -181,6 +182,7 @@ class Invite < Vue
               ' to become a committer for ' + @pmc
             @proposalText = 'I propose to invite ' + @iclaname +
               ' to become a committer.'
+            @voteProposalText = @proposalText + ' Here is my +1.'
           }
           _span @phasePrefix +
             ' invite to become a committer'
@@ -193,6 +195,7 @@ class Invite < Vue
               ' to become committer and ' + @pmcOrPPMC + ' member for ' + @pmc
             @proposalText = 'I propose to invite ' + @iclaname +
               ' to become a committer and ' + @pmcOrPPMC + ' member.'
+            @voteProposalText = @proposalText + ' Here is my +1.'
           }
           _span @phasePrefix +
             ' invite to become a committer and ' + @pmcOrPPMC + ' member'
@@ -227,11 +230,16 @@ class Invite < Vue
         onChange: self.setdiscussComment
     end
     if @showVoteFrame
+      _div 'From: ' + @member
+      _div 'To: private@' + @pmc_mail[@pmc] + '.apache.org'
       _div 'Subject: ' + @subject
+      _p
+      _span @voteProposalText
+      _p
       _textarea.form_control rows: 4,
-      placeholder: 'This is a vote for the candidate. Here is my +1',
-      name: 'voteBody', value: @voteBody,
-      onChange: self.setVoteBody
+      placeholder: 'Here are my reasons:',
+      name: 'voteComment', value: @voteComment,
+      onChange: self.setvoteComment
     end
 
     #
@@ -319,6 +327,41 @@ class Invite < Vue
     end
     _p
 
+    #
+    # Hidden form: preview vote email
+    #
+    _div.modal.fade.vote_preview! do
+      _div.modal_dialog do
+        _div.modal_content do
+          _div.modal_header do
+            _button.close "\u00d7", type: 'button', data_dismiss: 'modal'
+            _h4 'Vote Email'
+          end
+
+          _div.modal_body do
+            # headers
+            _div do _b 'From: '
+              _span @member
+            end
+            _div do _b 'To: '
+              _span @pmcEmail
+            end
+            _div do _b 'Subject: '
+              _span @subject
+            end
+            _div do _b
+              _pre @message
+            end
+          end
+
+          _div.modal_footer do
+            _button.btn.btn_default 'Close', data_dismiss: 'modal'
+          end
+        end
+      end
+    end
+    _p
+
   end
   # when the form is initially loaded, set the focus on the iclaname field
   def mounted()
@@ -354,7 +397,7 @@ class Invite < Vue
     @phase = :discuss
     @subject = ''
     @subjectPhase = '[DISCUSS]'
-    @previewMessage = 'Start Discussion'
+    @previewMessage = 'Start the Discussion'
     @phasePrefix = ' Start the discussion to'
     @showDiscussFrame = true;
     @showRoleFrame = true;
@@ -377,7 +420,7 @@ class Invite < Vue
     @phase = :vote
     @subject = ''
     @subjectPhase = '[VOTE]'
-    @previewMessage = 'Preview Vote'
+    @previewMessage = 'Start the Vote'
     @phasePrefix = ' Start the vote to'
     @showVoteFrame = true;
     @showRoleFrame = true;
@@ -392,8 +435,8 @@ class Invite < Vue
     @disabled = false;
   end
 
-  def setVoteBody(event)
-    @voteBody = event.target.value
+  def setvoteComment(event)
+    @voteComment = event.target.value
   end
 
   def selectInvite(event)
@@ -552,20 +595,25 @@ class Invite < Vue
       iclaname: @iclaname,
       iclaemail: @iclaemail,
       pmc: @pmc,
-      voteBody: @voteBody
+      proposer: @member,
+      subject: @subject,
+      proposalText: @voteProposalText,
+      voteComment: @voteComment,
+      voteComment: @voteComment
     }
 
     @disabled = true
     @alert = nil
-    post 'validate', data do |response|
+    post 'vote', data do |response|
+      console.log(response.inspect)
       @disabled = false
       @alert = response.error
       @memberEmail = response.memberEmail
       @pmcEmail = response.pmcEmail
-      @invitation = response.invitation
       @token = response.token
+      @message = response.message
       document.getElementById(response.focus).focus() if response.focus
-      jQuery('#invitation-preview').modal(:show) unless @alert
+      jQuery('#vote-preview').modal(:show) unless @alert
     end
   end
 
diff --git a/www/project/icla/views/pages/vote.js.rb b/www/project/icla/views/pages/vote.js.rb
index 23295c2..013a0b5 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -23,7 +23,7 @@ class Vote < Vue
     @iclaname = @contributor[:name]
     @iclaemail = @contributor[:email]
     @token = Server.data.token
-    @comments = @progress[:comments]
+    @comments = @progress[:comments] ? @progress[:comments]: []
     @votes = @progress[:votes]
     @vote = ''
     @timestamp = ''

-- 
To stop receiving notification emails like this one, please contact
clr@apache.org.