You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/07/03 23:11:44 UTC
[whimsy] branch master updated: Use common routines to update the
progress files
This is an automated email from the ASF dual-hosted git repository.
sebb 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 a1eff91 Use common routines to update the progress files
a1eff91 is described below
commit a1eff91f72596e35a47f0991f9d379a381c7e125
Author: Sebb <se...@apache.org>
AuthorDate: Wed Jul 4 00:11:42 2018 +0100
Use common routines to update the progress files
---
www/project/icla/views/pages/discuss.js.rb | 21 ++++++++++--
www/project/icla/views/pages/vote.js.rb | 51 ++++++++++++++++++++----------
2 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/www/project/icla/views/pages/discuss.js.rb b/www/project/icla/views/pages/discuss.js.rb
index c285c55..0d87891 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -157,18 +157,33 @@ class Discuss < Vue
# TODO
def submitComment(event)
- alert('submitComment: not implemented')
console.log('submitComment discussBody: ' + @discussBody.inspect)
+ updateVoteFile('submitComment')
end
def startVoting(event)
- alert('startVoting: not implemented')
console.log('startVoting discussBody: ' + @discussBody.inspect)
+ updateVoteFile('startVoting')
end
def invite(event)
- alert('invite: not implemented')
console.log('invite discussBody: ' + @discussBody.inspect)
+ updateVoteFile('invite')
+ end
+
+ def updateVoteFile(action)
+ data = {
+ action: action,
+ token: @token,
+ member: @member,
+ comment: @discussBody,
+ }
+ console.log(">update: "+ data.inspect) # debug
+ post 'update', data do |response|
+ console.log("<update: "+ response.inspect) # debug
+ @alert = response.error
+ @comments = response['contents']['comments'] 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 2e37f35..d31f027 100644
--- a/www/project/icla/views/pages/vote.js.rb
+++ b/www/project/icla/views/pages/vote.js.rb
@@ -17,20 +17,21 @@ class Vote < Vue
elsif @phase != 'vote'
@alert = "Wrong phase: " + @phase + "; should be vote"
else
- @pmc = @progress[:project]
- @proposer = @progress[:proposer]
- @contributor = @progress[:contributor]
- @iclaname = @contributor[:name]
- @iclaemail = @contributor[:email]
- @token = Server.data.token
- @comments = @progress[:comments] ? @progress[:comments]: []
- @votes = @progress[:votes]
- @vote = ''
- @timestamp = ''
- @commentBody = ''
- @subject = @progress[:subject]
- @showComment = false;
- @debug = Server.data.debug
+ @pmc = @progress[:project]
+ console.log('pmc: ' + @pmc)
+ @proposer = @progress[:proposer]
+ @contributor = @progress[:contributor]
+ @iclaname = @contributor[:name]
+ @iclaemail = @contributor[:email]
+ @token = Server.data.token
+ @comments = @progress[:comments] ? @progress[:comments] : []
+ @votes = @progress[:votes]
+ @vote = ''
+ @timestamp = ''
+ @commentBody = ''
+ @subject = @progress[:subject]
+ @showComment = false;
+ @debug = Server.data.debug
end
end
@@ -178,17 +179,33 @@ class Vote < Vue
def submitVote(event)
console.log('submitVote:' + event)
- alert('submitVote: Not yet implemented')
+ updateVoteFile('submitVote')
end
def cancelVote(event)
console.log('cancelVote:' + event)
- alert('cancelVote: Not yet implemented')
+ updateVoteFile('cancelVote')
end
def tallyVote(event)
console.log('tallyVote:' + event)
- alert('tallyVote: Not yet implemented')
+ updateVoteFile('tallyVote')
+ end
+
+ def updateVoteFile(action)
+ data = {
+ action: action,
+ vote: @vote,
+ member: @member,
+ token: @token,
+ }
+ data['comment']=@commentBody if @vote == '-1'
+ console.log(">update: "+ data.inspect) # debug
+ post 'update', data do |response|
+ console.log("<update: "+ response.inspect) # debug
+ @alert = response.error
+ @votes = response['contents']['votes'] unless @alert
+ end
end
# when the form is redisplayed, e.g. after displaying/hiding the commentBody