You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/04/09 00:59:14 UTC

[whimsy] branch master updated: establish resolutions

This is an automated email from the ASF dual-hosted git repository.

rubys 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 c89e8e1  establish resolutions
c89e8e1 is described below

commit c89e8e1c1d19466f7d8a447f170b9734cce74d88
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Apr 8 20:59:03 2018 -0400

    establish resolutions
---
 www/board/agenda/views/actions/post-data.json.rb |  14 ++-
 www/board/agenda/views/buttons/post.js.rb        | 138 ++++++++++++++++++++++-
 2 files changed, 144 insertions(+), 8 deletions(-)

diff --git a/www/board/agenda/views/actions/post-data.json.rb b/www/board/agenda/views/actions/post-data.json.rb
index eed927c..d22d471 100644
--- a/www/board/agenda/views/actions/post-data.json.rb
+++ b/www/board/agenda/views/actions/post-data.json.rb
@@ -71,13 +71,23 @@ when 'change-chair'
 
 when 'establish'
   @people = @people.split(',').map {|id| ASF::Person[id]}
+  @people.sort_by! {|person| ASF::Person.sortable_name(person.public_name)}
+  @description = @description.strip.sub(/\.\z/, '')
   @chair = ASF::Person[@chair]
-  @pmcname.capitalize! unless @pmcname =~ /[A-Z]/
+  @pmcname.gsub!(/\b\w/) {|c| c.upcase} unless @pmcname =~ /[A-Z]/
 
   template = File.read('templates/establish.erb').untaint
   draft = Erubis::Eruby.new(template).result(binding)
+  names = draft[/^(\s*\*.*\n)+/]
+  if names
+    draft[/^(\s*\*.*\n)+/] = "\n<-...@->\n"
+    draft = draft.reflow(0, 71)
+    draft.sub! "\n<-...@->\n", names
+  else
+    draft = draft.reflow(0, 71)
+  end
 
-  {draft: draft.reflow(0, 71)}
+  {draft: draft, names: names}
 
 when 'terminate'
   @committee = ASF::Committee[@pmc]
diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index 96aaba1..c14fcbc 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -35,7 +35,8 @@ class Post < Vue
           end
   
           _li do
-            _button.btn.btn_primary 'Establish Project', disabled: true
+            _button.btn.btn_primary 'Establish Project', onClick: selectItem
+            _ '- direct to TLP project'
           end
   
           _li do
@@ -93,6 +94,80 @@ class Post < Vue
         _button.btn_primary 'Draft', disabled: @disabled,
           onClick: draft_chair_change_resolution
 
+      elsif @button == 'Establish Project'
+        _h4 'Establish Project Resolution'
+
+        _div.form_group do
+          _label 'PMC name', for: 'establish-pmc'
+          _input.form_control.establish_pmc! value: @pmcname
+        end
+
+        _div.form_group do
+          # capitalize pmcname
+          pmcname = @pmcname
+          if @pmcname and @pmcname !~ /[A-Z]/
+            pmcname.gsub!(/\b\w/) {|c| c.upcase()} 
+          end
+
+          _label 'Complete this sentence:', for: 'establish-description'
+          _ " Apache #{pmcname} consists of software related to" if pmcname
+
+          _textarea.form_control.establish_description! value: @pmcdesc,
+            disabled: !pmcname
+        end
+
+        if @chair
+          _div.form_group do
+            _label "Chair: #{@chair.name}"
+          end
+        end
+
+        _label 'Initial set of PMC members'
+
+        _p do 
+          if !@chair
+              _ 'Search for the chair '
+          else
+              _ 'Search for additional PMC members '
+          end
+          _ 'using the search box below, and select '
+          _ 'the desired name using the associated checkbox'
+        end
+
+        @pmc.each do |person|
+          _div.form_check do
+            _input.form_check_input type: 'checkbox', checked: true,
+              value: person.id, id: "person_#{person.id}"
+            _label.form_check_label person.name, for: "person_#{person.id}"
+          end
+        end
+
+        _input.form_control value: @search, placeholder: 'search'
+
+        if @search.length >= 3 and Server.committers
+          search = @search.downcase().split(' ')
+          Server.committers.each do |person|
+            if
+              search.all? {|part|
+                person.id.include? part or
+                person.name.downcase().include? part
+              }
+            then
+              _div.form_check do
+                _input.form_check_input type: 'checkbox',
+                  id: "person_#{person.id}",
+                  onClick: -> {establish_pmc(person)}
+                _label.form_check_label person.name, 
+                  for: "person_#{person.id}"
+              end
+            end
+          end
+        end
+
+        _button.btn_default 'Cancel', data_dismiss: 'modal', disabled: @disabled
+        _button.btn_primary 'Draft', onClick: draft_establish_project,
+          disabled: (!@pmcname or !@pmcdesc or @pmc.empty?)
+
       elsif @button == 'Terminate Project'
         _h4 'Terminate Project Resolution'
 
@@ -129,7 +204,6 @@ class Post < Vue
         _button.btn_primary 'Draft', onClick: draft_terminate_project,
           disabled: (@pmcs.empty? or not @termreason)
 
-
       elsif @button == 'Out of Cycle Report'
         _h4 'Out of Cycle PMC Report'
 
@@ -192,6 +266,8 @@ class Post < Vue
 
     if @button == 'Change Chair'
       initialize_chair_change()
+    elsif @button == 'Establish Project'
+      initialize_establish_project()
     elsif @button == 'Terminate Project'
       initialize_terminate_project()
     elsif @button == 'Out of Cycle Report'
@@ -320,10 +396,10 @@ class Post < Vue
     return if @title
     match = nil
 
-    if (match = @report.match(/appointed\s+to\s+the\s+office\s+of\s+Vice\s+President,\s+Apache\s+(.*?),/))
-      @title = "Change the Apache #{match[1]} Project Chair"
-    elsif (match = @report.match(/to\s+be\s+known\s+as\s+the\s+"Apache\s+(.*?)\s+Project",\s+be\s+and\s+hereby\s+is\s+established/))
+    if (match = @report.match(/to\s+be\s+known\s+as\s+the\s+"Apache\s+(.*?)\s+Project",\s+be\s+and\s+hereby\s+is\s+established/))
       @title = "Establish the Apache #{match[1]} Project"
+    elsif (match = @report.match(/appointed\s+to\s+the\s+office\s+of\s+Vice\s+President,\s+Apache\s+(.*?),/))
+      @title = "Change the Apache #{match[1]} Project Chair"
     elsif (match = @report.match(/the\s+Apache\s+(.*?)\s+project\s+is\s+hereby\s+terminated/))
       @title = "Terminate the Apache #{match[1]} Project"
     end
@@ -473,6 +549,56 @@ class Post < Vue
   end
 
   #########################################################################
+  #                            Establish Project                          #
+  #########################################################################
+
+  def initialize_establish_project()
+    @search = ''
+
+    @pmcname = nil
+    @pmcdesc = nil
+    @chair = nil
+    @pmc = []
+
+    unless Server.committers
+      retrieve 'committers', :json do |committers|
+        Server.committers = committers || []
+      end
+    end
+  end
+
+  def establish_pmc(person)
+    @chair = person unless @chair
+    @pmc << person
+    @search = ''
+  end
+
+  def draft_establish_project()
+    @disabled = true
+
+    people = []
+    Array(document.querySelectorAll(':checked')).each do |checkbox|
+      people << checkbox.value
+    end
+
+    options = {
+      request: 'establish', 
+      pmcname: @pmcname,
+      description: @pmcdesc,
+      chair: @chair.id,
+      people: people.join(',')
+    }
+
+    post 'post-data', options do |response|
+      @button = @header = 'Add Resolution'
+      @title = response.title
+      @report = response.draft
+      @label = 'resolution'
+      @disabled = false
+    end
+  end
+
+  #########################################################################
   #                            Terminate Project                          #
   #########################################################################
 
@@ -483,7 +609,7 @@ class Post < Vue
       @pmcs = response
     end
 
-    @terreason = nil
+    @termreason = nil
   end
 
   def draft_terminate_project()

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