whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: reorder board agenda 2nd column
Date Mon, 16 Jan 2017 19:53:17 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  d2f3ef5   reorder board agenda 2nd column
d2f3ef5 is described below

commit d2f3ef59d05630ee9ff6f5b0df035116017c32b2
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Mon Jan 16 14:52:55 2017 -0500

    reorder board agenda 2nd column
---
 lib/whimsy/asf/ldap.rb                             | 51 +++++++++++++++
 .../agenda/views/elements/additional-info.js.rb    | 73 ++++++++++++----------
 2 files changed, 91 insertions(+), 33 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index a2ad810..0689886 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -691,6 +691,9 @@ module ASF
     end
   end
 
+  # Ultimately, this will include both PMCs and PPMCs, and enable separate
+  # updating of owners and members.  For now this is only used for PPMCs
+  # and owners and members are kept in sync.
   class Project < Base
     @base = 'ou=project,ou=groups,dc=apache,dc=org'
 
@@ -698,6 +701,10 @@ module ASF
       ASF.search_one(base, filter, 'cn').flatten
     end
 
+    def dn
+      @dn ||= ASF.search_one(base, "cn=#{name}", 'dn').first.first
+    end
+
     def members
       members = weakref(:members) do
         ASF.search_one(base, "cn=#{name}", 'member').flatten
@@ -705,6 +712,50 @@ module ASF
 
       members.map {|uid| Person.find uid[/uid=(.*?),/,1]}
     end
+
+    def owners
+      owners = weakref(:owners) do
+        ASF.search_one(base, "cn=#{name}", 'owner').flatten
+      end
+
+      owners.map {|uid| Person.find uid[/uid=(.*?),/,1]}
+    end
+
+    # remove people from a project
+    def remove(people)
+      @owners = nil
+      removals = (Array(people) & owners).map(&:dn)
+      unless removals.empty?
+        ASF::LDAP.modify(self.dn, [ASF::Base.mod_delete('owner', removals)])
+      end
+
+      @members = nil
+      removals = (Array(people) & members).map(&:dn)
+      unless removals.empty?
+        ASF::LDAP.modify(self.dn, [ASF::Base.mod_delete('member', removals)])
+      end
+    ensure
+      @members = nil
+      @owners = nil
+    end
+
+    # add people to a project
+    def add(people)
+      @owners = nil
+      additions = (Array(people) - owners).map(&:dn)
+      unless additions.empty?
+        ASF::LDAP.modify(self.dn, [ASF::Base.mod_add('owner', additions)])
+      end
+
+      @members = nil
+      additions = (Array(people) - members).map(&:dn)
+      unless additions.empty?
+        ASF::LDAP.modify(self.dn, [ASF::Base.mod_add('member', additions)])
+      end
+    ensure
+      @members = nil
+      @owners = nil
+    end
   end
 
   class Committee < Base
diff --git a/www/board/agenda/views/elements/additional-info.js.rb b/www/board/agenda/views/elements/additional-info.js.rb
index 2d15866..b6d9774 100644
--- a/www/board/agenda/views/elements/additional-info.js.rb
+++ b/www/board/agenda/views/elements/additional-info.js.rb
@@ -1,11 +1,12 @@
 #
 # Display information associated with an agenda item:
 #   - special notes
+#   - minutes
 #   - posted reports
+#   - action items
 #   - posted comments
 #   - pending comments
-#   - action items
-#   - minutes
+#   - historical comments
 #
 # Note: if AdditionalInfo is included multiple times in a page, set
 #       prefix to true (or a string) to ensure rendered id attributes
@@ -17,6 +18,13 @@ class AdditionalInfo < React
     # special notes
     _p.notes @@item.notes if @@item.notes
 
+    # minutes
+    minutes = Minutes.get(@@item.title)
+    if minutes
+      _h4 'Minutes', id: "#{@prefix}minutes"
+      _pre.comment minutes
+    end
+
     # posted reports
     if @@item.missing
       posted = Posted.get(@@item.title)
@@ -30,6 +38,25 @@ class AdditionalInfo < React
       end
     end
 
+    # action items
+    if @@item.title != 'Action Items' and not @@item.actions.empty?
+      _h4 id: "#{@prefix}actions" do
+        _Link text: 'Action Items', href: 'Action-Items'
+      end
+      _ActionItems item: @@item, filter: {pmc: @@item.title}
+    end
+
+    unless @@item.special_orders.empty?
+      _h4 'Special Orders', id: "#{@prefix}orders"
+      _ul do
+        @@item.special_orders.each do |resolution|
+          _li do
+            _Link text: resolution.title, href: resolution.href
+          end
+        end
+      end
+    end
+
     # posted comments
     history = HistoricalComments.find(@@item.title)
     if not @@item.comments.empty? or (history and not @prefix)
@@ -40,6 +67,12 @@ class AdditionalInfo < React
         end
       end
 
+      # pending comments
+      if @@item.pending
+        _h5 'Pending Comment', id: "#{@prefix}pending"
+        _pre.comment Flow.comment(@@item.pending, Pending.initials)
+      end
+
       # historical comments
       if history and not @prefix
         for date in history
@@ -71,39 +104,13 @@ class AdditionalInfo < React
           end
         end
       end
-    end
-
-    # pending comments
-    if @@item.pending
-      _h4 'Pending Comment', id: "#{@prefix}pending"
-      _pre.comment Flow.comment(@@item.pending, Pending.initials)
-    end
-
-    # action items
-    if @@item.title != 'Action Items' and not @@item.actions.empty?
-      _h4 id: "#{@prefix}actions" do
-        _Link text: 'Action Items', href: 'Action-Items'
-      end
-      _ActionItems item: @@item, filter: {pmc: @@item.title}
-    end
-
-    unless @@item.special_orders.empty?
-      _h4 'Special Orders', id: "#{@prefix}orders"
-      _ul do
-        @@item.special_orders.each do |resolution|
-          _li do
-            _Link text: resolution.title, href: resolution.href
-          end
-        end
+    else
+      # pending comments
+      if @@item.pending
+        _h4 'Pending Comment', id: "#{@prefix}pending"
+        _pre.comment Flow.comment(@@item.pending, Pending.initials)
       end
     end
-
-    # minutes
-    minutes = Minutes.get(@@item.title)
-    if minutes
-      _h4 'Minutes', id: "#{@prefix}minutes"
-      _pre.comment minutes
-    end
   end
 
   # ensure componentWillReceiveProps is called on before first rendering

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

Mime
View raw message