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 2016/09/28 18:14:30 UTC
[whimsy] branch master updated: rough in org chart
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 fa5585a rough in org chart
fa5585a is described below
commit fa5585a8979550d6909363ff7fff1a77e9e40b2b
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 28 14:14:16 2016 -0400
rough in org chart
---
www/roster/Gemfile | 2 +
www/roster/main.rb | 26 ++++++++++
www/roster/models.rb | 1 +
www/roster/models/orgchart.rb | 24 +++++++++
www/roster/views/duties.html.rb | 105 ++++++++++++++++++++++++++++++++++++++
www/roster/views/orgchart.html.rb | 39 ++++++++++++++
6 files changed, 197 insertions(+)
diff --git a/www/roster/Gemfile b/www/roster/Gemfile
index fc8614a..f05b832 100644
--- a/www/roster/Gemfile
+++ b/www/roster/Gemfile
@@ -19,6 +19,8 @@ gem 'sinatra', '~> 1.4'
gem 'nokogumbo'
gem 'execjs'
gem 'mail'
+gem 'kramdown'
+gem 'sanitize'
group :development do
gem 'passenger'
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 8c0efd1..8fd0013 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -13,6 +13,7 @@ require 'wunderbar/sinatra'
require 'wunderbar/bootstrap/theme'
require 'wunderbar/react'
require 'wunderbar/underscore'
+require 'wunderbar/markdown'
require 'wunderbar/jquery/stupidtable'
require 'ruby2js/filter/functions'
require 'ruby2js/filter/require'
@@ -137,3 +138,28 @@ end
get '/attic/issues.json' do
_json Attic.issues
end
+
+# overall organization chart
+get '/orgchart/' do
+ @org = OrgChart.load
+ _html :orgchart
+end
+
+# individual duties
+get '/orgchart/:name' do |name|
+ person = ASF::Person.find(env.user)
+
+ unless person.asf_member? or ASF.pmc_chairs.include? person
+ halt 401, "Not authorized\n"
+ end
+
+ @org = OrgChart.load
+ @role = @org[name]
+ pass unless @role
+
+ @oversees = @org.select do |role, duties|
+ duties['info']['reports-to'].split(/[, ]+/).include? name
+ end
+
+ _html :duties
+end
diff --git a/www/roster/models.rb b/www/roster/models.rb
index 3717e44..e497682 100644
--- a/www/roster/models.rb
+++ b/www/roster/models.rb
@@ -3,6 +3,7 @@ require_relative 'models/auth'
require_relative 'models/committer'
require_relative 'models/committee'
require_relative 'models/group'
+require_relative 'models/orgchart'
require_relative 'models/ldap'
require_relative 'models/svn'
diff --git a/www/roster/models/orgchart.rb b/www/roster/models/orgchart.rb
new file mode 100644
index 0000000..bee3972
--- /dev/null
+++ b/www/roster/models/orgchart.rb
@@ -0,0 +1,24 @@
+class OrgChart
+ @@duties = {}
+
+ def self.load
+ @@source ||= ASF::SVN['private/foundation/officers/personnel-duties']
+
+ Dir["#{@@source}/*.txt"].each do |file|
+ name = file[/.*\/(.*?)\.txt/, 1]
+ next if @@duties[name] and @@duties[name]['mtime'] > File.mtime(file).to_f
+ data = Hash[*File.read(file).split(/^\[(.*)\]\n/)[1..-1].map(&:strip)]
+ next unless data['info']
+ data['info'] = YAML.load(data['info'])
+ data['mtime'] = File.mtime(file).to_f
+ @@duties[name] = data
+ end
+
+ @@duties
+ end
+
+ def self.[](name)
+ self.load
+ @@duties[name]
+ end
+end
diff --git a/www/roster/views/duties.html.rb b/www/roster/views/duties.html.rb
new file mode 100644
index 0000000..e23cc0c
--- /dev/null
+++ b/www/roster/views/duties.html.rb
@@ -0,0 +1,105 @@
+#
+# Organization Chart
+#
+
+_html do
+ _title @role['info']['role']
+ _base href: '..'
+ _link rel: 'stylesheet', href: 'stylesheets/app.css'
+
+ _banner breadcrumbs: {
+ roster: '.',
+ orgchart: 'orgchart/'
+ }
+
+ # ********************************************************************
+ # * Summary *
+ # ********************************************************************
+
+ id = @role['info']['id'] || @role['info']['chair']
+ _h1_ "#{@role['info']['role']} - #{ASF::Person.find(id).public_name}"
+
+ _h2_ 'Quick Info'
+
+ _table.table do
+ _tbody do
+ @role['info'].each do |key, value|
+ next if key == 'role'
+ next unless value
+
+ _tr_ do
+ _td key
+
+ if %w(id chair).include? key
+ _td do
+ if value == 'tbd'
+ _span value
+ else
+ _a value, href: "roster/#{value}"
+ end
+ end
+ elsif %w(reports-to).include? key
+ _td! do
+ value.split(/[, ]+/).each_with_index do |role, index|
+ _span ', ' if index > 0
+ if role == 'members'
+ _a role, href: "roster/members"
+ else
+ _a role, href: "orgchart/#{role}"
+ end
+ end
+ end
+ elsif %w(email).include? key
+ _td do
+ _a value, href: "mailto:#{value}"
+ end
+ elsif %w(private-list).include? key
+ _td do
+ if value == 'board-private@apache.org'
+ _a value, href: "mailto:#{value}"
+ else
+ _a value, href: "https://lists.apache.org/list.html?#{value}"
+ end
+ end
+ elsif %w(roster resolution).include? key
+ _td do
+ _a value, href: value
+ end
+ else
+ _td value
+ end
+ end
+ end
+ end
+ end
+
+ # ********************************************************************
+ # * Oversees *
+ # ********************************************************************
+
+ unless @oversees.empty?
+ @oversees = @oversees.sort_by {|name, duties| duties['info']['role']}
+ _h2 'Oversees'
+ _table.table do
+ _tbody do
+ @oversees.each do |name, duties|
+ _tr do
+ _td do
+ _a duties['info']['role'], href: "orgchart/#{name}"
+ end
+ end
+ end
+ end
+ end
+ end
+
+ # ********************************************************************
+ # * Details *
+ # ********************************************************************
+
+ @role.each do |title, text|
+ next if title == 'info' or title == 'mtime'
+ _h2.text_capitalize title
+ _markdown text
+ end
+end
diff --git a/www/roster/views/orgchart.html.rb b/www/roster/views/orgchart.html.rb
new file mode 100644
index 0000000..e7aba02
--- /dev/null
+++ b/www/roster/views/orgchart.html.rb
@@ -0,0 +1,39 @@
+#
+# Organization Chart
+#
+
+_html do
+ _title 'ASF Orgchart'
+ _base href: '..'
+ _link rel: 'stylesheet', href: 'stylesheets/app.css'
+
+ _banner breadcrumbs: {
+ roster: '.'
+ }
+
+ _h1_ 'ASF Organization Chart'
+
+ _table.table do
+ _thead do
+ _th 'Title'
+ _th 'Contact, Chair, or Person holding that title'
+ end
+
+ _tbody do
+ @org.sort_by {|key, value| value['info']['role']}.each do |key, value|
+ _tr_ do
+ # title
+ _td do
+ _a value['info']['role'], href: "orgchart/#{key}"
+ end
+
+ # person holding the role
+ _td do
+ id = value['info']['id'] || value['info']['chair']
+ _a ASF::Person.find(id).public_name, href: "committer/#{id}"
+ end
+ end
+ end
+ end
+ end
+end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].