whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject [whimsy] branch master updated: Add projects/icla/discuss page
Date Fri, 12 Jan 2018 22:24:57 GMT
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 63c0ad1  Add projects/icla/discuss page
63c0ad1 is described below

commit 63c0ad1727b0b17201a89dcac8b66c0858e38d8e
Author: Craig L Russell <craig.russell@oracle.com>
AuthorDate: Fri Jan 12 14:24:46 2018 -0800

    Add projects/icla/discuss page
---
 www/project/icla/main.rb                   |  25 ++-
 www/project/icla/views/app.html.rb         |   5 +-
 www/project/icla/views/pages/discuss.js.rb | 247 +++++------------------------
 3 files changed, 68 insertions(+), 209 deletions(-)

diff --git a/www/project/icla/main.rb b/www/project/icla/main.rb
index d7b2a2b..df2b853 100755
--- a/www/project/icla/main.rb
+++ b/www/project/icla/main.rb
@@ -64,14 +64,33 @@ end
 
 get '/discuss' do
   @view = 'discuss'
+  @user = env.user
 
   # 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']
+  @token = params['token']
+  # not needed for this form but required for other forms
+  @pmcs = []
+  @ppmcs = []
+  @pmc_mail = {}
+
+  # mocked for testing
+  @contributor = {
+    project: 'whimsy',
+    name: 'Joe Blow',
+    email: 'joe@blow.com'
+  }
+  @subject = '[DISCUSS] 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]
 
   _html :app
 end
diff --git a/www/project/icla/views/app.html.rb b/www/project/icla/views/app.html.rb
index b106da4..52e9609 100755
--- a/www/project/icla/views/app.html.rb
+++ b/www/project/icla/views/app.html.rb
@@ -373,7 +373,10 @@ _html lang: 'en', _width: '80' do
     _script src: 'app.js'
 
     _.render '#main' do
-      _Main data: {pmcs: @pmcs, ppmcs: @ppmcs, pmc_mail: @pmc_mail}, view: @view
+      _Main data: {pmcs: @pmcs, ppmcs: @ppmcs, pmc_mail: @pmc_mail,
+        token: @token, contributor: @contributor, comments: @comments,
+        user: @user, subject: @subject, phase: @phase, votes: @votes},
+        view: @view
     end
   end
 end
diff --git a/www/project/icla/views/pages/discuss.js.rb b/www/project/icla/views/pages/discuss.js.rb
index d10c301..5b84693 100644
--- a/www/project/icla/views/pages/discuss.js.rb
+++ b/www/project/icla/views/pages/discuss.js.rb
@@ -4,142 +4,63 @@ class Discuss < 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
+    @pmc = Server.data.contributor[:project]
+    @iclaname = Server.data.contributor[:name]
+    @iclaemail = Server.data.contributor[:email]
+    @token = Server.data.token
+    @comments = Server.data.comments
+    @discussBody = ''
+    @subject = Server.data.subject
+    @debug = true;
 
   end
 
   def render
     _p %{
-      This application allows PMC and PPMC members to:
-      discuss contributors to achieve consensus;
-      vote on contributors to become a committer or a PMC or PPMC member; or
-      simply invite them to submit an ICLA.
+      This form allows PMC and PPMC members to
+      discuss contributors to achieve consensus.
     }
-
-    # error messages
-    if @alert
-      _div.alert.alert_danger do
-        _b 'Error: '
-        _span @alert
-      end
-    end
-
+    _b "Project: " + @pmc
+    _p
+    _b "Contributor: " + @iclaname + " (" + @iclaemail + ")"
+    _p
+    _p "Subject: " + @subject
+    _p
     #
     # Form fields
     #
-
     _div.form_group do
-      _label "Contributor's name:", for: 'iclaname'
-      _input.form_control.iclaname! placeholder: 'GivenName FamilyName',
-        required: true, value: @iclaname
-    end
+      _label "Comment from " + @user, for: 'discussBody'
+      _textarea.form_control rows: 4,
+      placeholder: 'new comment',
+      name: 'discussBody', value: @discussBody,
+      onChange: self.setDiscussBody
+    end
+    @comments.each {|c|
+      _b 'From: ' + c.member + ' Date: ' + c.timestamp
+      _p c.comment
+    }
 
-    _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
+    _p 'token: ' + @token
+    _p 'comment: ' + @discussBody
 
-    _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
+    # error messages
+    if @alert
+      _div.alert.alert_danger do
+        _b 'Error: '
+        _span @alert
       end
     end
 
-    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.
-      }
-    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 comment', disabled: @disabled,
+        onClick: self.submitComment
     end
 
     #
@@ -184,103 +105,19 @@ class Discuss < Vue
       end
     end
 
-
   end
 
-  # when the form is initially loaded, set the focus on the iclaname field
+  # when the form is initially loaded, set the focus on the discussBody field
   def mounted()
-    document.getElementById('iclaname').focus()
+    document.getElementById('discussBody').focus()
   end
 
   #
   # field setters
   #
 
-  def setIclaName(event)
-    @iclaname = event.target.value
-    self.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()
+  def setDiscussBody(event)
+    @discussBody = event.target.value
   end
 
   #
@@ -289,9 +126,9 @@ class Discuss < Vue
 
   # client side field validations
   def checkValidity()
-    @disabled = !%w(iclaname iclaemail pmc votelink noticelink).all? do |id|
+    @disabled = !%w(discussBody).all? do |id|
       element = document.getElementById(id)
-      (not element) or element.checkValidity()
+      not element.empty?
     end
   end
 

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

Mime
View raw message