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 2017/10/09 19:20:55 UTC

[whimsy] branch master updated: track reports which were not accepted

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 00bcfa8  track reports which were not accepted
00bcfa8 is described below

commit 00bcfa867c7019654cad9c220c886566f8b6aaa7
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon Oct 9 15:20:25 2017 -0400

    track reports which were not accepted
---
 lib/whimsy/asf/committee.rb                        | 22 +++++++++++++---
 www/board/agenda/public/stylesheets/app.css        | 10 +++++++-
 www/board/agenda/views/actions/minute.json.rb      |  7 ++++++
 www/board/agenda/views/actions/todos.json.rb       |  3 ++-
 www/board/agenda/views/buttons/add-comment.js.rb   |  3 ++-
 www/board/agenda/views/buttons/add-minutes.js.rb   | 29 +++++++++++++++++++++-
 .../agenda/views/elements/additional-info.js.rb    |  4 +++
 www/board/agenda/views/elements/modal-dialog.js.rb |  2 +-
 www/board/agenda/views/models/agenda.js.rb         | 10 +++++---
 www/board/agenda/views/models/minutes.js.rb        |  4 +++
 www/board/agenda/views/models/pending.js.rb        | 21 ++++++++--------
 11 files changed, 93 insertions(+), 22 deletions(-)

diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 16d785d..15eacaf 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -119,7 +119,7 @@ module ASF
     # update next month section.  Remove entries that have reported or
     # or expired; add (or update) entries that are missing; add entries
     # for new committees.
-    def self.update_next_month(contents, date, missing, establish)
+    def self.update_next_month(contents, date, missing, rejected, establish)
       # extract next month section; and then extract the lines containing
       # '#' signs from within that section
       next_month = contents[/Next month.*?\n\n/m].chomp
@@ -131,12 +131,21 @@ module ASF
 
       # update/remove existing 'missing' entries
       existing = []
-      block.gsub! /(.*?)# missing in .*\n/ do |line|
-        if missing.include? $1.strip
+      block.gsub! /(.*?)# (missing|not accepted) in .*\n/ do |line|
+        if rejected.include? $1.strip
           existing << $1.strip
           if line.chomp.end_with? month
             line
           else
+            "#{line.chomp}, not accepted #{month}\n"
+          end
+        elsif missing.include? $1.strip
+          existing << $1.strip
+          if line.chomp.end_with? month
+            line
+          elsif line.split(',').last.include? 'not accepted'
+            "#{line.chomp}, missing #{month}\n"
+          else
             "#{line.chomp}, #{month}\n"
           end
         else
@@ -144,8 +153,13 @@ module ASF
         end
       end
 
+      # add new 'rejected' entries
+      (rejected-existing).each do |pmc|
+        block += "    #{pmc.ljust(22)} # not accepted in #{month}\n"
+      end
+
       # add new 'missing' entries
-      (missing-existing).each do |pmc|
+      (missing-rejected-existing).each do |pmc|
         block += "    #{pmc.ljust(22)} # missing in #{month}\n"
       end
 
diff --git a/www/board/agenda/public/stylesheets/app.css b/www/board/agenda/public/stylesheets/app.css
index dfa528c..a04da02 100644
--- a/www/board/agenda/public/stylesheets/app.css
+++ b/www/board/agenda/public/stylesheets/app.css
@@ -51,6 +51,15 @@ aside li {list-style: none}
   border-radius: 1em;
 }
 
+.rejected {
+  background-color: #F88; 
+  padding: 0.3em 1em; 
+  margin: 1em 1em 0 1em;
+  font-weight: bold;
+  border: 1px solid SkyBlue;
+  border-radius: 1em;
+}
+
 /* posted_reports */
 .posted-reports {
   list-style: none;
@@ -527,4 +536,3 @@ input[type=file]#upload {
   font-family: monospace;
   overflow: hidden;
 }
-}
diff --git a/www/board/agenda/views/actions/minute.json.rb b/www/board/agenda/views/actions/minute.json.rb
index 23f27b6..8d84494 100644
--- a/www/board/agenda/views/actions/minute.json.rb
+++ b/www/board/agenda/views/actions/minute.json.rb
@@ -110,6 +110,13 @@ else
   minutes.delete 'complete' if @title == 'Adjournment'
 end
 
+if @reject
+  minutes[:rejected] ||= []
+  minutes[:rejected] << @title unless minutes[:rejected].include? @title
+elsif minutes[:rejected]
+  minutes[:rejected].delete @title
+end
+
 File.write minutes_file, YAML.dump(minutes)
 
 minutes
diff --git a/www/board/agenda/views/actions/todos.json.rb b/www/board/agenda/views/actions/todos.json.rb
index c3e9ccb..9f00f0a 100644
--- a/www/board/agenda/views/actions/todos.json.rb
+++ b/www/board/agenda/views/actions/todos.json.rb
@@ -74,8 +74,9 @@ if (@change || @establish || @terminate) and env.password
       missing = parsed_agenda.
         select {|item| item[:attach] =~ /^[A-Z]+$/ and item['missing']}.
         map {|item| item['title']}
+      rejected = minutes[:rejected] || []
       contents = ASF::Committee.update_next_month(contents, 
-        Date.parse(date.gsub('_', '-')), missing, 
+        Date.parse(date.gsub('_', '-')), missing, rejected,
         Array(@establish).map {|resolution| resolution['name']})
     end
 
diff --git a/www/board/agenda/views/buttons/add-comment.js.rb b/www/board/agenda/views/buttons/add-comment.js.rb
index e173054..b506325 100644
--- a/www/board/agenda/views/buttons/add-comment.js.rb
+++ b/www/board/agenda/views/buttons/add-comment.js.rb
@@ -44,7 +44,8 @@ class AddComment < Vue
         placeholder: 'comment', rows: 5, disabled: @disabled
 
       if Server.role == :director and @@item.attach =~ /^[A-Z]+$/
-        _input.flag! type: 'checkbox', label: 'item requires discussion or follow up',
+        _input.flag! type: 'checkbox', 
+          label: 'item requires discussion or follow up',
           onClick: self.flag, checked: @checked
       end
 
diff --git a/www/board/agenda/views/buttons/add-minutes.js.rb b/www/board/agenda/views/buttons/add-minutes.js.rb
index c0f0410..c3a12d2 100644
--- a/www/board/agenda/views/buttons/add-minutes.js.rb
+++ b/www/board/agenda/views/buttons/add-minutes.js.rb
@@ -44,6 +44,12 @@ class AddMinutes < Vue
         _textarea.col_md_7 value: @ai_text, rows: 1, cols: 40, tabIndex: 2
       end
 
+      if @@item.attach =~ /^[A-Z]+$/
+        _input.flag! type: 'checkbox', 
+          label: 'report was not accepted',
+          onClick: self.reject, checked: @checked
+      end
+
       # variable number of buttons
       _button.btn_default 'Cancel', type: 'button', data_dismiss: 'modal',
         onClick:-> {@draft = @base}
@@ -69,6 +75,10 @@ class AddMinutes < Vue
 
   # autofocus on minute text
   def mounted()
+    jQuery('#minute-form').on 'show.bs.modal' do
+      self.setup(@@item)
+    end
+
     jQuery('#minute-form').on 'shown.bs.modal' do
       document.getElementById("minute-text").focus()
     end
@@ -90,6 +100,7 @@ class AddMinutes < Vue
     @draft = draft
     @ai_owner = item.shepherd
     @indent = (@@item.attach =~ /^\w+$/ ? 8 : 4)
+    @checked = @@item.rejected
   end
 
   # add an additional AI to the draft minutes for this item
@@ -130,7 +141,8 @@ class AddMinutes < Vue
     data = {
       agenda: Agenda.file,
       title: @@item.title,
-      text: text
+      text: text,
+      reject: @checked
     }
 
     @disabled = true
@@ -142,4 +154,19 @@ class AddMinutes < Vue
       document.body.classList.remove('modal-open')
     end
   end
+
+  def reject(event)
+    @checked = ! @checked
+
+    data = {
+      agenda: Agenda.file,
+      title: @@item.title,
+      text: @base,
+      reject: @checked
+    }
+
+    post 'minute', data do |minutes|
+      Minutes.load minutes
+    end
+  end
 end
diff --git a/www/board/agenda/views/elements/additional-info.js.rb b/www/board/agenda/views/elements/additional-info.js.rb
index 1b61b06..ec193a4 100644
--- a/www/board/agenda/views/elements/additional-info.js.rb
+++ b/www/board/agenda/views/elements/additional-info.js.rb
@@ -16,6 +16,10 @@
 class AdditionalInfo < Vue
   def render
     # special notes
+    if @@item.rejected
+      _p.rejected 'Report was not accepted'
+    end
+
     if @@item.notes
       _p @@item.notes, 
         class: ('notes' unless @@item.notes =~ /^new, monthly through/)
diff --git a/www/board/agenda/views/elements/modal-dialog.js.rb b/www/board/agenda/views/elements/modal-dialog.js.rb
index b575512..3e1b594 100644
--- a/www/board/agenda/views/elements/modal-dialog.js.rb
+++ b/www/board/agenda/views/elements/modal-dialog.js.rb
@@ -35,7 +35,7 @@ class ModalDialog < Vue
           if slot.data.attrs.type == 'checkbox'
             props.class = ['checkbox']
             label = Vue.createElement('label', props, [slot,
-              slot.data.attrs.label])
+              Vue.createElement('span', slot.data.attrs.label)])
             slot.data.attrs.delete 'label'
             slot = nil
           else
diff --git a/www/board/agenda/views/models/agenda.js.rb b/www/board/agenda/views/models/agenda.js.rb
index df61522..cda4c9e 100644
--- a/www/board/agenda/views/models/agenda.js.rb
+++ b/www/board/agenda/views/models/agenda.js.rb
@@ -164,6 +164,10 @@ class Agenda
     end
   end
 
+  def rejected
+    Minutes.rejected and Minutes.rejected.include?(@title)
+  end
+
   # compute href by taking the title and replacing all non alphanumeric
   # characters with dashes
   def href
@@ -192,7 +196,7 @@ class Agenda
 
   # retrieve the pending comment (if any) associated with this agenda item
   def pending
-    Pending.comments[@attach]
+    Pending.comments and Pending.comments[@attach]
   end
 
   # retrieve the action items associated with this agenda item
@@ -456,7 +460,7 @@ class Agenda
 
   # determine if this item is flagged, accounting for pending actions
   def flagged
-    return true if Pending.flagged.include? @attach
+    return true if Pending.flagged and Pending.flagged.include? @attach
     return false unless @flagged_by
     return false if @flagged_by.length == 1 and 
       @flagged_by.first == Server.initials and 
@@ -470,7 +474,7 @@ class Agenda
       'blank'
     elsif @warnings
       'missing'
-    elsif self.missing
+    elsif self.missing or self.rejected
       'missing'
     elsif @approved
       if self.flagged
diff --git a/www/board/agenda/views/models/minutes.js.rb b/www/board/agenda/views/models/minutes.js.rb
index d868f62..77d63c9 100644
--- a/www/board/agenda/views/models/minutes.js.rb
+++ b/www/board/agenda/views/models/minutes.js.rb
@@ -38,6 +38,10 @@ class Minutes
     @@list.attendance
   end
 
+  def self.rejected
+    @@list.rejected
+  end
+
   # return a list of actual or expected attendee names
   def self.attendee_names
     names = []
diff --git a/www/board/agenda/views/models/pending.js.rb b/www/board/agenda/views/models/pending.js.rb
index c235322..572686c 100644
--- a/www/board/agenda/views/models/pending.js.rb
+++ b/www/board/agenda/views/models/pending.js.rb
@@ -13,36 +13,37 @@ class Pending
   end
 
   def self.count
+    return 0 unless Server.pending
     self.comments.keys().length + 
-      self.approved.keys().length +
-      self.unapproved.keys().length +
-      self.flagged.keys().length +
-      self.unflagged.keys().length +
+      self.approved.length +
+      self.unapproved.length +
+      self.flagged.length +
+      self.unflagged.length +
       self.status.keys().length
   end
 
   def self.comments
-    Server.pending ? Server.pending.comments : []
+    (Server.pending && Server.pending.comments) || {}
   end
 
   def self.approved
-    Server.pending.approved
+    Server.pending.approved || []
   end
 
   def self.unapproved
-    Server.pending.unapproved
+    Server.pending.unapproved || []
   end
 
   def self.flagged
-    Server.pending.flagged
+    Server.pending.flagged || []
   end
 
   def self.unflagged
-    Server.pending.unflagged
+    Server.pending.unflagged || []
   end
 
   def self.seen
-    Server.pending.seen
+    Server.pending.seen || {}
   end
 
   def self.initials

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