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 05:49:38 UTC
[whimsy] branch master updated: Rough in project/icla/vote
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 6839843 Rough in project/icla/vote
6839843 is described below
commit 6839843ccabd9f0825539f723d20ffe3614c0b72
Author: Craig L Russell <cr...@oracle.com>
AuthorDate: Fri Jan 12 21:49:28 2018 -0800
Rough in project/icla/vote
---
www/project/icla/main.rb | 36 +++-
www/project/icla/views/app.html.rb | 3 +-
www/project/icla/views/pages/discuss.js.rb | 7 +
www/project/icla/views/pages/vote.js.rb | 280 +++++++++--------------------
4 files changed, 126 insertions(+), 200 deletions(-)
diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index bf5029f..2f171c4 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -78,6 +78,7 @@ get '/discuss' do
@pmc_mail = {}
# mocked for testing
+ @proposer = 'shane'
@contributor = {
project: 'whimsy',
name: 'Joe Blow',
@@ -98,14 +99,37 @@ end
get '/vote' do
@view = 'vote'
-
- # get a complete list of PMC and PPMC names and mail lists
- projects = projectsForUser(env.user)
+ @user = env.user
# server data sent to client
- @pmcs = projects['pmcs']
- @ppmcs = projects['ppmcs']
- @pmc_mail = projects['pmcmail']
+ @token = params['token']
+
+ # not needed for this form but required for other forms
+ @pmcs = []
+ @ppmcs = []
+ @pmc_mail = {}
+
+ # mocked for testing
+ @proposer = 'shane'
+ @contributor = {
+ project: 'whimsy',
+ name: 'Joe Blow',
+ email: 'joe@blow.com'
+ }
+ @subject = '[VOTE] Invite Joe Blow to become committer '\
+ 'and PMC member for whimsy'
+ comment1 = {member: 'sebb', timestamp: '11/30/2017 15:30:00',
+ comment: "Seems like a good enough guy"}
+ comment2 = {member: 'rubys', timestamp: '12/04/2017 17:20:00',
+ comment: "I agree"}
+ comment3 = {member: 'clr', timestamp: '12/06/2017 10:14:00',
+ comment: "We could do better\nMuch better"}
+ @comments = [comment1, comment2, comment3]
+
+ vote1 = {vote: '+1', member: 'sebb', timestamp: '12/19/2017 15:30:00'}
+ vote2 = {vote: '+1', member: 'clr', timestamp: '12/20/2017 14:20:00'}
+ vote3 = {vote: '+1', member: 'rubys', timestamp: '12/22/2017 10:33:00'}
+ @votes = [vote1, vote2, vote3]
_html :app
end
diff --git a/www/project/icla/views/app.html.rb b/www/project/icla/views/app.html.rb
index 52e9609..fe6a366 100755
--- a/www/project/icla/views/app.html.rb
+++ b/www/project/icla/views/app.html.rb
@@ -375,7 +375,8 @@ _html lang: 'en', _width: '80' do
_.render '#main' 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},
+ user: @user, subject: @subject, phase: @phase, votes: @votes,
+ proposer: @proposer},
view: @view
end
end
diff --git a/www/project/icla/views/pages/discuss.js.rb b/www/project/icla/views/pages/discuss.js.rb
index 0770f72..4c5ca10 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -5,6 +5,7 @@ class Discuss < Vue
# initialize form fields
@user = Server.data.user
+ @proposer = Server.data.proposer
@pmc = Server.data.contributor[:project]
@iclaname = Server.data.contributor[:name]
@iclaemail = Server.data.contributor[:email]
@@ -25,6 +26,8 @@ class Discuss < Vue
_p
_b "Contributor: " + @iclaname + " (" + @iclaemail + ")"
_p
+ _b "Proposed by: " + @proposer
+ _p
_p "Subject: " + @subject
_p
#
@@ -66,6 +69,10 @@ end
_button.btn.btn_primary 'Submit comment and start voting',
disabled: @disabled,
onClick: self.startVoting
+ _b ' or '
+ _button.btn.btn_primary 'Submit comment and invite contributor to submit ICLA',
+ disabled: @disabled,
+ onClick: self.invite
end
#
diff --git a/www/project/icla/views/pages/vote.js.rb b/www/project/icla/views/pages/vote.js.rb
index e5c1715..bd52771 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -4,29 +4,62 @@ class Vote < Vue
@alert = nil
# initialize form fields
- @iclaname = ''
- @iclaemail = ''
- @pmc = ''
- @votelink = ''
- @noticelink = ''
-
-# initialize conditional text
- @showPMCVoteLink = false;
- @showPPMCVoteLink = false;
- @voteErrorMessage = '';
- @showVoteErrorMessage = false;
- @showPMCNoticeLink = false;
- @showPPMCNoticeLink = false;
- @noticeErrorMessage = '';
- @showNoticeErrorMessage = false;
+ @user = Server.data.user
+ @proposer = Server.data.proposer
+ @pmc = Server.data.contributor[:project]
+ @iclaname = Server.data.contributor[:name]
+ @iclaemail = Server.data.contributor[:email]
+ @token = Server.data.token
+ @comments = Server.data.comments
+ @votes = Server.data.votes
+ @vote = ''
+ @timestamp = ''
+ @commentBody = ''
+ @subject = Server.data.subject
+ @showComment = true;
+ @debug = false;
end
def render
_p %{
- This application allows PMC and PPMC members to vote to invite a
- contributor to become a committer and/or PMC or PPMC member.
+ This form allows PMC and PPMC members to
+ vote to invite a contributor to become a committer or a PMC/PPMC member.
}
+ _b "Project: " + @pmc
+ _p
+ _b "Contributor: " + @iclaname + " (" + @iclaemail + ")"
+ _p
+ _b "Proposed by: " + @proposer
+ _p
+ _p "Subject: " + @subject
+ _p
+ _div.form_group.vote do
+ _label do
+ _input type: 'radio', name: 'vote', value: '+1',
+ onClick: -> {@vote = '+1'; @showComment = false; checkValidity()}
+ _span " +1 approve "
+ end
+ _p
+ _label do
+ _input type: 'radio', name: 'vote', value: '+0',
+ onClick: -> {@vote = '+0'; @showComment = false; checkValidity()}
+ _span " +0 don't care "
+ end
+ _p
+ _label do
+ _input type: 'radio', name: 'vote', value: '-0',
+ onClick: -> {@vote = '-0'; @showComment = false; checkValidity()}
+ _span " -0 don't care "
+ end
+ _p
+ _label do
+ _input type: 'radio', name: 'vote', value: '-1',
+ onClick: -> {@vote = '-1'; @showComment = true; checkValidity()}
+ _span " -1 disapprove, because... "
+ end
+ _p
+ end
# error messages
if @alert
@@ -39,107 +72,50 @@ class Vote < Vue
#
# Form fields
#
-
- _div.form_group do
- _label "Contributor's name:", for: 'iclaname'
- _input.form_control.iclaname! placeholder: 'GivenName FamilyName',
- required: true, value: @iclaname
+ if @showComment
+ _div.form_group do
+ _textarea.form_control rows: 4,
+ placeholder: 'reason to disapprove',
+ id: 'commentBody', value: @commentBody,
+ onChange: self.setCommentBody
+ end
end
- _div.form_group do
- _label "Contributor's E-Mail address:", for: 'iclaemail'
- _input.form_control.iclaemail! type: 'email', required: true,
- placeholder: 'user@example.com', onChange: self.setIclaEmail,
- value: @iclaemail
- end
+ @votes.each {|v|
+ _p v.vote + ' From: ' + v.member + ' Date: ' + v.timestamp
+ }
- _div.form_group do
- _label "PMC/PPMC", for: 'pmc'
- _select.form_control.pmc! required: true, onChange: self.setPMC, value: @pmc do
- _option ''
- Server.data.pmcs.each do |pmc|
- _option pmc
- end
- _option '---'
- Server.data.ppmcs.each do |ppmc|
- _option ppmc
- end
- end
- end
+ @comments.each {|c|
+ _b 'From: ' + c.member + ' Date: ' + c.timestamp
+ _p c.comment
+ }
- if @showPMCVoteLink
- _p %{
- Fill the following field only if the person was voted by the PMC
- to become a committer.
- Link to the [RESULT][VOTE] message in the mail archives.
- }
- end
- if @showPPMCVoteLink
- _p %{
- Fill the following field only if the person is an initial
- committer on a new project accepted for incubation, or the person
- has been voted as a committer on a podling.
- For new incubator projects use the
- http://wiki.apache.org/incubator/XXXProposal link; for existing
- podlings link to the [RESULT][VOTE] message in the mail archives.
- }
+ if @debug
+ _p 'token: ' + @token
+ _p 'comment: ' + @commentBody
+ _p 'vote: ' + @vote
end
- if @showPMCVoteLink or @showPPMCVoteLink
- _ 'Navigate to '
- _a "ponymail", href: "https://lists.apache.org"
- _ ', select the appropriate message, right-click PermaLink, copy link'
- _ ' to the clip-board, and paste the link here.'
- _p
- _div.form_group do
- _label "VOTE link", for: 'votelink'
- _input.form_control.votelink! type: 'url', onChange: self.setVoteLink,
- value: @votelink
- end
- if @showVoteErrorMessage
- _div.alert.alert_danger do
- _span @voteErrorMessage
- end
- end
- end
- if @showPMCNoticeLink
- _p %{
- Fill the following field only if the person was voted by the PMC
- to become a PMC member.
- Link to the [NOTICE] message sent to the board.
- The message must have been in the archives for at least 72 hours.
- }
- end
- if @showPPMCNoticeLink
- _p %{
- Fill the following field only if the person was voted by the
- PPMC to be a PPMC member.
- Link to the [NOTICE] message sent to the incubator PMC.
- The message must have been in the archives for at least 72 hours.
- }
- end
- if @showPMCNoticeLink or @showPPMCNoticeLink
- _div.form_group do
- _label "NOTICE link", for: 'noticelink'
- _input.form_control.noticelink! type: 'url', onChange: self.setNoticeLink,
- value: @noticelink
- end
- end
- if @showNoticeErrorMessage
- _div.alert.alert_danger do
- _span @noticeErrorMessage
- end
- end
#
# Submission button
#
_p do
- _button.btn.btn_primary 'Preview Invitation', disabled: @disabled,
- onClick: self.previewInvitation
+ _button.btn.btn_primary 'Submit my vote', disabled: @disabled,
+ onClick: self.submitVote
+ _b ' or '
+ _button.btn.btn_primary 'Cancel the vote', disabled: @disabled,
+ onClick: self.cancelVote
+ _b ' or '
+ _button.btn.btn_primary 'Tally the vote', disabled: @disabled,
+ onClick: self.tallyVote
end
+
+
+
+
#
# Hidden form: preview invite email
#
@@ -187,99 +163,18 @@ class Vote < Vue
# when the form is initially loaded, set the focus on the iclaname field
def mounted()
- document.getElementById('iclaname').focus()
+ document.getElementById('commentBody').focus()
end
#
# field setters
#
-
- def setIclaName(event)
- @iclaname = event.target.value
- self.checkValidity()
+ def setCommentBody(event)
+ @commentBody = event.target.value
+ checkValidity()
end
- def setIclaEmail(event)
- @iclaemail = event.target.value
- self.checkValidity()
- end
-
- def setPMC(event)
- @pmc = event.target.value
- @showPMCVoteLink = Server.data.pmcs.include? @pmc
- @showPPMCVoteLink = Server.data.ppmcs.include? @pmc
- @showPMCNoticeLink = Server.data.pmcs.include? @pmc
- @showPPMCNoticeLink = Server.data.ppmcs.include? @pmc
- @showVoteErrorMessage = false;
- @showNoticeErrorMessage = false;
- checkVoteLink() if document.getElementById('votelink');
- checkNoticeLink() if document.getElementById('noticelink');
- self.checkValidity()
- end
- def setVoteLink(event)
- @votelink = event.target.value
- @showVoteErrorMessage = false
- checkVoteLink()
- self.checkValidity()
- end
-
- def checkVoteLink()
- document.getElementById('votelink').setCustomValidity('');
- if (@votelink)
- # verify that the link refers to lists.apache.org message on the project list
- if not @votelink=~ /.*lists\.apache\.org.*/
- @voteErrorMessage = "Error: Please link to\
- a message via lists.apache.org"
- @showVoteErrorMessage = true;
- end
- if not @votelink=~ /.*private\@#{Server.data.pmc_mail[@pmc]}(\.incubator)?\.apache\.org.*/
- @voteErrorMessage = "Error: Please link to\
- the [RESULT][VOTE] message sent to the private list."
- @showVoteErrorMessage = true;
- end
- if @showVoteErrorMessage
- document.getElementById('votelink').setCustomValidity(@voteErrorMessage);
- end
- end
- end
-
- def setNoticeLink(event)
- @noticelink = event.target.value
- @showNoticeErrorMessage = false;
- checkNoticeLink()
- self.checkValidity()
- end
-
- def checkNoticeLink()
- document.getElementById('noticelink').setCustomValidity('');
- # verify that the link refers to lists.apache.org message on the proper list
- if (@noticelink)
- if not @noticelink=~ /.*lists\.apache\.org.*/
- @noticeErrorMessage = "Error: please link to\
- a message via lists.apache.org"
- @showNoticeErrorMessage = true;
- end
- if @showPMCNoticeLink and not @noticelink=~ /.*board\@apache\.org.*/
- @noticeErrorMessage = "Error: please link to\
- the NOTICE message sent to the board list."
- @showNoticeErrorMessage = true;
- end
- if @showPPMCNoticeLink and not @noticelink=~ /.*private\@incubator\.apache\.org.*/
- @noticeErrorMessage = "Error: please link to\
- the NOTICE message sent to the incubator private list."
- @showNoticeErrorMessage = true;
- end
- if @showNoticeErrorMessage
- document.getElementById('noticelink').setCustomValidity(@noticeErrorMessage);
- end
- end
- end
-
- def setInvitation(event)
- @invitation = event.target.value
- self.checkValidity()
- end
#
# validation and processing
@@ -287,12 +182,11 @@ class Vote < Vue
# client side field validations
def checkValidity()
- @disabled = !%w(iclaname iclaemail pmc votelink noticelink).all? do |id|
- element = document.getElementById(id)
- (not element) or element.checkValidity()
- end
+ # 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>'].