This is an automated email from the ASF dual-hosted git repository.
sebb 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 abaf03e5 Allow for multiple ids in a role
abaf03e5 is described below
commit abaf03e5e8bc1b13a55ffd544bf362e31fd5bac1
Author: Sebb <[email protected]>
AuthorDate: Wed Aug 2 23:21:48 2023 +0100
Allow for multiple ids in a role
---
lib/whimsy/asf/orgchart.rb | 6 +++---
www/foundation/orgchart.cgi | 33 +++++++++++++++++++++++----------
www/roster/views/duties.html.rb | 14 ++++++++++----
www/roster/views/orgchart.html.rb | 5 ++++-
4 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/lib/whimsy/asf/orgchart.rb b/lib/whimsy/asf/orgchart.rb
index c1a36dac..7118ba1f 100644
--- a/lib/whimsy/asf/orgchart.rb
+++ b/lib/whimsy/asf/orgchart.rb
@@ -33,10 +33,10 @@ module ASF # :nodoc:
if name =~ %r{^vp-(.+)$} or name =~ %r{^(security)$}
post = $1
begin
- data['info']['id'] = ASF::Committee[post].chairs.first[:id]
+ data['info']['id'] = ASF::Committee[post].chairs.map {|a| a[:id]}
rescue
begin
- data['info']['id'] = ASF::Committee.officers.select{|o| o.name
== post}.first.chairs.first[:id]
+ data['info']['id'] = ASF::Committee.officers.select{|o| o.name
== post}.first.chairs.map {|a| a[:id]}
rescue
Wunderbar.info "Cannot find chair for #{name}"
end
@@ -44,7 +44,7 @@ module ASF # :nodoc:
else
tmp = ASF::Committee.officers.select{|o| o.name == name}.first
if tmp
- data['info']['id'] = tmp.chairs.first[:id]
+ data['info']['id'] = tmp.chairs.map {|a| a[:id]}
else
Wunderbar.info "Cannot find chair for #{name}"
end
diff --git a/www/foundation/orgchart.cgi b/www/foundation/orgchart.cgi
index 713176be..2f8571c7 100755
--- a/www/foundation/orgchart.cgi
+++ b/www/foundation/orgchart.cgi
@@ -43,11 +43,11 @@ def emit_orgchart(org: {})
end
_td do
id = value['info']['id'] || value['info']['chair']
- tmp = ASF::Person[id]
- if tmp.nil?
+ missingid, idnam = _id_to_names(id)
+ if missingid
_em id
else
- _ tmp.public_name
+ _ idnam
end
end
_td do
@@ -61,15 +61,28 @@ def emit_orgchart(org: {})
end
end
+def _id_to_names(id)
+ return true, '' if id.nil?
+ ids=[]
+ id = [id].flatten # allows for single id and array
+ missingid = false
+ id.each do |id1|
+ tmp = ASF::Person[id1]
+ if tmp.nil?
+ ids << id1
+ missingid = true
+ else
+ ids << tmp.public_name
+ end
+ end
+ idnam = ids.join(', ')
+ return missingid, idnam
+end
+
# Output one role's duties and data
def emit_role(role: {}, oversees: {}, desc: {})
id = role['info']['id'] || role['info']['chair']
- tmp = ASF::Person[id]
- if tmp.nil?
- idnam = id
- else
- idnam = tmp.public_name
- end
+ missingid, idnam = _id_to_names(id)
_ol.breadcrumb do
_li do
_a 'OrgChart', href: URLROOT
@@ -96,7 +109,7 @@ def emit_role(role: {}, oversees: {}, desc: {})
end
if %w(id chair).include? key
_td do
- if tmp.nil?
+ if missingid
_em idnam
else
_ idnam
diff --git a/www/roster/views/duties.html.rb b/www/roster/views/duties.html.rb
index 29a95ec9..74bcbaa0 100644
--- a/www/roster/views/duties.html.rb
+++ b/www/roster/views/duties.html.rb
@@ -14,9 +14,13 @@ _html do
orgchart: 'orgchart/' # This is a sub-page of orgchart
}
) do
- id = @role['info']['id'] || @role['info']['chair']
+ id = @role['info']['id'] || @role['info']['chair'] # may be single id or
array
+ names= []
+ [id].flatten.each do |id1|
+ names << ASF::Person.find(id1).public_name
+ end
_whimsy_panel_table(
- title: "#{@role['info']['role']} -
#{ASF::Person.find(id).public_name}",
+ title: "#{@role['info']['role']} - #{names.join(', ')}",
helpblock: -> {
_ 'Note that this detail page includes '
_span.glyphicon.glyphicon_lock :aria_hidden, class: 'text-primary',
aria_label: 'ASF Members Private'
@@ -40,8 +44,10 @@ _html do
if value == 'tbd'
_span value
else
-# TODO allow for multiple holders?
- _a value, href: "committer/#{value}"
+ [value].flatten.each_with_index do |value1, i| # may be
single id or array of ids
+ _ ', ' if i > 0
+ _a value1, href: "committer/#{value1}"
+ end
end
end
elsif %w(reports-to).include? key
diff --git a/www/roster/views/orgchart.html.rb
b/www/roster/views/orgchart.html.rb
index 7403d5a2..3f062172 100644
--- a/www/roster/views/orgchart.html.rb
+++ b/www/roster/views/orgchart.html.rb
@@ -41,7 +41,10 @@ _html do
# person holding the role
_td do
id = value['info']['id'] || value['info']['chair']
- _a ASF::Person.find(id).public_name, href: "committer/#{id}"
+ [id].flatten.each_with_index do |id1, i| # may be single id
or array
+ _ ',' if i > 0
+ _a ASF::Person.find(id1).public_name, href:
"committer/#{id1}"
+ end
end
# Website - often valuable to people looking for info