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 2017/12/28 22:55:56 UTC
[whimsy] branch master updated: scaffolding for discuss and 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 388d3b5 scaffolding for discuss and vote
new add7726 Merge branch 'master' of github.com:apache/whimsy
388d3b5 is described below
commit 388d3b5c908b2f5857e7411139ca88eac6f6e0f5
Author: Craig L Russell <cr...@oracle.com>
AuthorDate: Thu Dec 28 14:53:55 2017 -0800
scaffolding for discuss and vote
---
www/project/icla/main.rb | 84 ++++++++++++++++++++++++-------
www/project/icla/views/main.js.rb | 6 ++-
www/project/icla/views/pages.js.rb | 4 ++
www/project/icla/views/pages/invite.js.rb | 4 +-
4 files changed, 77 insertions(+), 21 deletions(-)
diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index 26a6cf6..27e8d96 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -12,10 +12,41 @@ require 'ruby2js/filter/require'
disable :logging # suppress log of requests to stderr/error.log
+helpers do
+ def projectsForUser(userName)
+ pmcs = ASF::Committee.pmcs.map(&:name).sort
+ ppmcs =ASF::Podling.list
+ .select {|podling| podling.status == 'current'}
+ .map(&:name).sort
+ user = ASF::Person.find(userName)
+ committees = user.committees.map(&:name)
+ pmcs.select! {|pmc| committees.include?(pmc)}
+ ppmcs.select! {|ppmc|
+ committees.include?('incubator') | committees.include?(ppmc)}
+ mailList = {}
+ pmcs.each {|pmcName| pmc = ASF::Committee.find(pmcName)
+ if pmc
+ mailList[pmcName] = pmc.mail_list
+ end
+ }
+ ppmcs.each {|ppmcName| ppmc = ASF::Committee.find(ppmcName)
+ if ppmc
+ mailList[ppmcName] = ppmc.mail_list
+ end
+ }
+ hash = {
+ 'pmcs' => pmcs,
+ 'ppmcs' => ppmcs,
+ 'pmcmail' => mailList
+ }
+ end
+end
+
#
# Sinatra routes
#
+
get '/' do
redirect to('/invite')
end
@@ -23,29 +54,46 @@ end
get '/invite' do
@view = 'invite'
- # get a complete list of PMC and PPMC names
- @pmcs = ASF::Committee.pmcs.map(&:name).sort
- @ppmcs = ASF::Podling.list
- .select {|podling| podling.status == 'current'}
- .map(&:name).sort
-
- # allow user to invite contributors for PMCs of which the user is a member,
- # or for podlings if the user is a member of the PPMC.
- user = ASF::Person.find(env.user)
- committees = user.committees.map(&:name)
- ipmc = committees.include?('incubator')
- @pmcs.select! {|pmc| committees.include?(pmc)}
- @ppmcs.select! {|ppmc| committees.include?('incubator') | committees.include?(ppmc)}
-
- # make a map of pmc name to pmc mail_list for validation of votes
- @pmc_mail = {}
- ASF::Committee.pmcs.each { |pmc| @pmc_mail[pmc.name] = pmc.mail_list}
- ASF::Podling.list.each { |ppmc| @pmc_mail[ppmc.name] = ppmc.mail_list}
+ # get a complete list of PMC and PPMC names and mail lists
+ projects = projectsForUser(env.user)
+
+ # server data sent to client
+ @pmcs = projects['pmcs']
+ @ppmcs = projects['ppmcs']
+ @pmc_mail = projects['pmcmail']
# render the HTML for the application
_html :app
end
+get '/discuss' do
+ @view = 'discuss'
+
+ # get a complete list of PMC and PPMC names and mail lists
+ projects = projectsForUser(env.user)
+
+ # server data sent to client
+ @pmcs = projects['pmcs']
+ @ppmcs = projects['ppmcs']
+ @pmc_mail = projects['pmcmail']
+
+ _html :app
+end
+
+get '/vote' do
+ @view = 'vote'
+
+ # get a complete list of PMC and PPMC names and mail lists
+ projects = projectsForUser(env.user)
+
+ # server data sent to client
+ @pmcs = projects['pmcs']
+ @ppmcs = projects['ppmcs']
+ @pmc_mail = projects['pmcmail']
+
+ _html :app
+end
+
get '/form' do
@view = 'interview'
_html :app
diff --git a/www/project/icla/views/main.js.rb b/www/project/icla/views/main.js.rb
index 16ef5a0..9b52716 100644
--- a/www/project/icla/views/main.js.rb
+++ b/www/project/icla/views/main.js.rb
@@ -9,7 +9,7 @@ class Main < Vue
def render
_main do
- _h1 'Demo: Invitation to Submit ICLA'
+ _h1 'Demo: Discuss, Vote, and Invite'
Vue.createElement(@view)
end
@@ -24,6 +24,10 @@ class Main < Vue
def mounted()
if @@view == 'interview'
@view = Interview
+ elsif @@view == 'discuss'
+ @view = Discuss
+ elsif @@view == 'vote'
+ @view = Vote
else
@view = Invite
end
diff --git a/www/project/icla/views/pages.js.rb b/www/project/icla/views/pages.js.rb
index 2896506..59ea3b3 100644
--- a/www/project/icla/views/pages.js.rb
+++ b/www/project/icla/views/pages.js.rb
@@ -1,3 +1,5 @@
+require_relative "pages/discuss"
+require_relative "pages/vote"
require_relative "pages/form"
require_relative "pages/invite"
require_relative "pages/complete"
@@ -5,6 +7,8 @@ require_relative "pages/interview"
require_relative "pages/preview"
Pages = [
+ "Discuss",
+ "Vote",
"Preview",
"Form",
"Interview",
diff --git a/www/project/icla/views/pages/invite.js.rb b/www/project/icla/views/pages/invite.js.rb
index 2620ae7..da6f4d3 100644
--- a/www/project/icla/views/pages/invite.js.rb
+++ b/www/project/icla/views/pages/invite.js.rb
@@ -43,7 +43,7 @@ class Invite < Vue
_div.form_group do
_label "Contributor's name:", for: 'iclaname'
- _input.form_control.iclaname! placeholder: 'Firstname Lastname',
+ _input.form_control.iclaname! placeholder: 'GivenName FamilyName',
required: true, value: @iclaname
end
@@ -234,7 +234,7 @@ class Invite < Vue
a message via lists.apache.org"
@showVoteErrorMessage = true;
end
- if not @votelink=~ /.*private\@#{Server.data.pmc_mail[@pmc]}(\.incubator)?\.apache\.org.*/
+ if not @votelink=~ /.*private\.#{@pmc_mail[@pmc]}(\.incubator)?\.apache\.org.*/
@voteErrorMessage = "Error: Please link to\
the [RESULT][VOTE] message sent to the private list."
@showVoteErrorMessage = true;
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].