Skip to content

Commit 5e051fa

Browse files
committed
Fix for astropy#194
1 parent 53fbe91 commit 5e051fa

5 files changed

Lines changed: 161 additions & 487 deletions

File tree

‎js/functions.js‎

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,90 @@ $( document ).ready(function(){
2020
$(this).addClass("subhover"); //On hover over, add class "subhover"
2121
}, function(){ //On Hover Out
2222
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
23-
2423
});
2524

25+
//creating Astropy roles table using roles.json
26+
var request = new XMLHttpRequest();
27+
var dataURL = "roles.json";
28+
request.open('GET', dataURL);
29+
request.responseType = 'json';
30+
request.send();
31+
32+
//log error when request gets failed
33+
request.onerror = function () {
34+
console.log("XHR error");
35+
};
36+
37+
request.onload = function () {
38+
//received json data via XHR
39+
var data = request.response;
40+
//creating roles table from json data
41+
createRolesTable(data);
42+
};
43+
44+
function createRolesTable(roles) {
45+
//roles is an array of objects called "role"
46+
var rows = '';
47+
roles.forEach(function (role) {
48+
//role is an object containing information about each team role
49+
//index marks current lead
50+
var index = 0;
51+
//regular expression used in searching for 1 in a string
52+
var regExp = /^1/i;
53+
//creating each row by iterating over each lead in a role
54+
role["lead"].forEach(function (lead) {
55+
//rowRole is displayed once for each role
56+
rowRole = index == 0 ? '<a href="#">' + role["role"] + '</a>' : "";
57+
58+
var rowSubRole = "";
59+
//checking if a value exists at an index in role["sub-role"] array
60+
if (typeof role["sub-role"][index] !== 'undefined' && role["sub-role"][index] !== null) {
61+
rowSubRole = role["sub-role"][index];
62+
}
63+
64+
//checking if lead is unfilled or prefer deputy role
65+
if (lead == "Unfilled") {
66+
lead = '<a href="mailto:[email protected]"><span style="font-style: italic;">Unfilled</span></a>';
67+
}
68+
if (regExp.test(lead)) {
69+
//replacing 1 from string
70+
lead = lead.replace(/^1/i, '');
71+
lead = '<span style="color: blue;">' + lead + '<sup>1</sup></span>';
72+
}
73+
74+
//checking if a value exists at an index in role["deputy"] array
75+
var rowDeputy = "";
76+
if (typeof role["deputy"][index] !== 'undefined' && role["deputy"][index] !== null) {
77+
rowDeputy = role["deputy"][index];
78+
if (rowDeputy == "Unfilled") {
79+
rowDeputy = '<a href="mailto:[email protected]"><span style="font-style: italic;">Unfilled</span></a>';
80+
}
81+
if (regExp.test(rowDeputy)) {
82+
//replacing 1 from string
83+
rowDeputy = rowDeputy.replace(/^1/i, '');
84+
rowDeputy = '<span style="color: blue;">' + rowDeputy + '<sup>1</sup></span>';
85+
}
86+
}
87+
88+
//generating rows
89+
rows += '<tr>' +
90+
'<td>' + rowRole + '</td>' +
91+
'<td>' + rowSubRole + '</td>' +
92+
'<td>' + lead + '</td>' +
93+
'<td>' + rowDeputy + '</td>' +
94+
'</tr>';
95+
index++;
96+
});
97+
});
98+
99+
rows += '<tr>' +
100+
'<td>' + '<span style="color: blue;"><sup>1</sup>Would prefer deputy role</span>' + '</td>' +
101+
'<td></td>' +
102+
'<td></td>' +
103+
'<td></td>' +
104+
'</tr>';
105+
$("#roles-table").append(rows);
106+
}
26107

27108
$('#os-selector ul').each(function(){
28109
// For each set of tabs, we want to keep track of

‎roles.json‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[
2+
{
3+
"role" : "Coordination committee member",
4+
"sub-role" : [],
5+
"lead" : ["Tom Aldcroft", "Kelle Cruz", "Tom Robitaille", "Erik Tollerud"],
6+
"deputy" : []
7+
}, {
8+
"role" : "Ombudsperson",
9+
"sub-role" : [],
10+
"lead" : ["Steve Crawford"],
11+
"deputy" : []
12+
}, {
13+
"role" : "Community engagement coordinator",
14+
"sub-role" : ["Overall", "Twitter", "Facebook", "Slack", "Conferences"],
15+
"lead" : ["Kelle Cruz", "Adrian Price-Whelan", "Kelle Cruz", "Tom Robitaille", "Adrian Price-Whelan"],
16+
"deputy" : ["Unfilled", "Tom Robitaille", "Tom Robitaille, Erik Tollerud", "Unfilled", "Erik Tollerud, Tom Robitaille, Kelle Cruz"]
17+
}, {
18+
"role" : "Astropy GSoC coordinator",
19+
"sub-role" : [],
20+
"lead" : ["Brigitta Sipocz"],
21+
"deputy" : ["Tom Aldcroft, Erik Tollerud"]
22+
}, {
23+
"role" : "Learn Coordinator",
24+
"sub-role" : [],
25+
"lead" : ["Kelle Cruz"],
26+
"deputy" : ["Unfilled"]
27+
}, {
28+
"role" : "Documentation & examples maintainer",
29+
"sub-role" : [],
30+
"lead" : ["Tom Robitaille"],
31+
"deputy" : ["Erik Tollerud"]
32+
}, {
33+
"role" : "Tutorial & guides",
34+
"sub-role" : ["Infrastructure", "Content"],
35+
"lead" : ["Adrian Price-Whelan", "Lia Corrales"],
36+
"deputy" : ["Erik Tollerud", "Unfilled"]
37+
}, {
38+
"role" : "Astropy.org web page maintainer",
39+
"sub-role" : [],
40+
"lead" : ["1Erik Tollerud"],
41+
"deputy" : ["Grant Tremblay"]
42+
}, {
43+
"role" : "Astropy-helpers maintainer",
44+
"sub-role" : [],
45+
"lead" : ["Unfilled"],
46+
"deputy" : ["Erik Tollerud, Brigitta Sipocz"]
47+
}, {
48+
"role" : "Astropy testing maintainer",
49+
"sub-role" : [],
50+
"lead" : ["Dan Davella"],
51+
"deputy" : ["Erik Tollerud, Tom Robitaille"]
52+
}, {
53+
"role" : "Package-template maintainer",
54+
"sub-role" : [],
55+
"lead" : ["1Tom Robitaille"],
56+
"deputy" : ["Brigitta Sipocz, Larry Bradley, Adrian Price-Whelan"]
57+
}, {
58+
"role" : "CI-helpers maintainer",
59+
"sub-role" : [],
60+
"lead" : ["Brigitta Sipocz"],
61+
"deputy" : ["Unfilled"]
62+
}, {
63+
"role" : "Distribution coordinator",
64+
"sub-role" : ["Conda", "Debian", "Fedora", "Gentoo", "ArchLinux", "MacPorts"],
65+
"lead" : ["Matt Craig", "Ole Streicher", "Sergio Pascual", "Sébastien Fabbro", "Médéric Boquien", "Christoph Deil"],
66+
"deputy" : ["Unfilled", "Unfilled", "Unfilled", "Unfilled", "Miguel de Val-Borro, Stuart Mumford", "Hans Moritz Günther"]
67+
}, {
68+
"role" : "Core package release coordinator",
69+
"sub-role" : [],
70+
"lead" : ["Brigitta Sipocz"],
71+
"deputy" : ["Tom Robitaille, Erik Tollerud"]
72+
}, {
73+
"role" : "Sub-package maintainer",
74+
"sub-role" : ["astropy.constants", "astropy.convolution", "astropy.coordinates", "astropy.cosmology", "astropy.io.ascii", "astropy.io.fits", "astropy.io.misc", "astropy.io.votable", "astropy.modeling", "astropy.nddata", "astropy.samp", "astropy.stats", "astropy.table", "astropy.time", "astropy.units", "astropy.utils", "astropy.visualization", "astropy.wcs"],
75+
"lead" : ["David Shupe", "Adam Ginsburg", "Erik Tollerud", "Alex Conley", "Tom Aldcroft", "Unfilled", "1Tom Robitaille", "Unfilled", "Nadia Dencheva", "Matt Craig", "1Tom Robitaille", "Steve Crawford", "Tom Aldcroft", "Tom Aldcroft", "Marten van Kerkwijk", "Pey Lian Lim", "Larry Bradley", "Unfilled"],
76+
"deputy" : ["Marten van Kerkwijk", "Axel Donath, Larry Bradley", "Stuart Littlefair, Adrian Price-Whelan", "Unfilled", "Hans Moritz Günther", "Simon Conseil, Michael Seifert, Dan D'Avella", "Matteo Bachetti", "Pey Lian Lim", "Pey Lian Lim", "Steve Crawford, Michael Seifert", "Unfilled", "Larry Bradley", "Marten van Kerkwijk", "Marten van Kerkwijk", "Adrian Price-Whelan", "Brigitta Sipocz, Erik Tollerud", "Tom Robitaille", "Nadia Dencheva"]
77+
}
78+
]

‎roles.txt‎

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)