[Ready]: Staff Directory Rewrite #2

Merged
Damian merged 9 commits from master into dev 2023-07-14 17:33:15 -04:00
3 changed files with 74 additions and 193 deletions

View File

@ -1,30 +0,0 @@
function getAbbreviations() {
const map = new Map();
map.set('FSEN', 'Fellow of Engineering & Software Development [Board Certified]');
map.set('FSM', 'Fellow of Moderation [Board Certified]');
map.set('FSCE', 'Fellow of Community Engagement [Board Certified]');
map.set('FSCR', 'Fellow of Community Relations & Member Support [Board Certified]');
map.set('FSO', 'Fellow of Operations [Board Certified]');
map.set('ENP', 'Engineering Practitioner [Board Certified]');
map.set('MDP', 'Moderation Practitioner [Board Certified]');
map.set('CEP', 'Community Engagement Practitioner [Board Certified]')
map.set('CRP', 'Community Relations & Member Support Practitioner [Board Certified]');
map.set('OAP', 'Operations Practitioner [Board Certified]');
map.set('CE-I', 'Community Relations Intern');
map.set('ENG-I', 'Engineering Intern');
map.set('MOD-I', 'Moderation Intern');
map.set('CRS-I', 'Community Relations & Member Support Intern');
map.set('OA-I', 'Operations Intern');
map.set('AD', 'Administrator');
map.set('SP', 'Supervisor');
map.set('ST', 'Staff Team/Core Team [Board Certified]');
map.set('AS-BC', 'Associate - Board Certified');
map.set('AS', 'Associate - Intern')
return map;
}
function visible() {
document.getElementById('roles').style.display = "table";
}
function invisible() {
document.getElementById('roles').style.display = "none";
}

View File

@ -1,128 +1,47 @@
<!--
Library of Code sp-us | Department of Engineering
Matthew, AD, FSEN <matthew@staff.libraryofcode.org>
COPYRIGHT 2020
-->
<!DOCTYPE html>
<head>
<title>Staff Directory</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="author" content="Damian Freeman" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:title" content="Staff Directory">
<meta property="og:url" content="https://directory.libraryofcode.org/">
<meta property="og:type" content="website">
<meta property="og:description" content="Staff Directory for Library of Code sp-us and list of titles and explanations.">
<title>Staff Directory</title>
<script src="getabb.js"></script>
</head>
<body>
<div class="container-fluid">
<h1>
Staff Directory
<small class="text-muted">directory.libraryofcode.org</small>
</h1>
<table class="table table-sm table-striped" id="directory" style="display: none;">
<thead class="thead-light">
<tr>
<th scope="col"><strong>Name</strong></th>
<th scope="col"><strong>Title/Department</strong></th>
<th scope="col"><strong>Email</strong></th>
<th scope="col"><strong>Pager Number</strong></th>
<th scope="col"><strong>Extension</strong></th>
<th scope="col"><strong>Keys</strong></th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="btn-group float-right" type="group">
<button id="button-show" type="button" class="btn btn-primary btn-sm float-right" onclick=visible()>Additional Staff Roles</button>
<button id="button-hide" type="button" class="btn btn-secondary btn-sm float-right" onclick=invisible()>Hide</button>
</div>
<link
rel="icon"
href="https://static.libraryofcode.org/library_of_code.png"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM"
crossorigin="anonymous"
/>
</head>
<body>
<div class="container-fluid">
<div class="table-responsive">
<table class="table table-bordered" id="roles" style="display: none; width:100%">
<thead class="thead-light">
<tr>
<th scope="col"><strong>Name</strong></th>
<th scope="col"><strong>Additional Titles/Roles</strong></th>
</tr>
</thead>
</table>
<table class="table" id="directory">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Title/Department</th>
<th scope="col">Email</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div
id="loading"
class="alert alert-info"
role="alert"
style="display: block"
>
Loading... |
</div>
</div>
<div id="loading" class="alert alert-info" role="alert" style="display: block;">
Loading... |
</div>
<script src="script.js"></script>
<h2>Speciality Titles</h2>
<p><i>Below are a list of specialty titles. Board Certification is awarded to those who complete internship in a specialty.</i></p>
<dl style="padding: 8px; display: block; border: 1px solid black;">
<dt>FSCE</dt>
<dd>Fellow of Community Engagement - Community Engagement/Events | Board Certified</dd>
<dt>CEP</dt>
<dd>Community Engagement Practitioner - Community Engagement/Events | Board Certified</dd>
<dt>CE-I</dt>
<dd>Community Engagement/Events | Intern</dd><br>
<dt>FSEN</dt>
<dd>Fellow of Engineering - Engineering & Software Development | Board Certified</dd>
<dt>ENP</dt>
<dd>Engineering Practitioner - Engineering & Software Development | Board Certified</dd>
<dt>ENG-I</dt>
<dd>Engineering & Software Development | Intern</dd><br>
<dt>FSM</dt>
<dd>Fellow of Moderation - Moderation | Board Certified</dd>
<dt>MDP</dt>
<dd>Moderation Practitioner - Moderation | Board Certified</dd>
<dt>MOD-I</dt>
<dd>Moderation | Intern</dd><br>
<dt>FSO</dt>
<dd>Fellow of Operations - Operations & Administration | Board Certified</dd>
<dt>OAP</dt>
<dd>Operations Practitioner - Operations & Administration | Board Certified</dd>
<dt>OA-I</dt>
<dd>Operations & Administration | Intern</dd><br>
<dt>FSCR</dt>
<dd>Fellow of Community Relations - Community Relations & Member Support | Board Certified</dd>
<dt>CRP</dt>
<dd>Community Relations Practitioner - Community Relations & Member Support | Board Certified</dd>
<dt>CRS-I</dt>
<dd>Community Relations & Member Support | Intern</dd><br>
</dl>
<h4>Positional Titles</h4>
<p><i>Below are a list of positional rankings which are awarded based on the chain of command.</i></p>
<dl style="padding: 8px; display: block; border: 1px solid black;">
<dt>AD</dt>
<dd>Administrator ~ administrator in one or more projects or departments</dd>
<dt>SP</dt>
<dd>Supervisor ~ high-level staff member in one or more departments with authority</dd>
<dt>ST</dt>
<dd>Staff/Core Team | Board Certified ~ board certified Core Team and Staff member</dd><br>
<dt>AS-BC</dt>
<dd>Associate | Board Certified ~ board certified Associate whom has completed training</dd>
<dt>AS</dt>
<dd>Associate | Intern ~ associate whom is currently an intern/in-training</dd>
<dt></dt>
</dl>
<h4>Member Titles</h4>
<p><i>Staff members and Associates are not eligible to receive these titles, they're reserved for community members only.</i></p>
<dl style="padding: 8px; display: block; border: 1px solid black;">
<dt>RCA</dt>
<dd>Registered Community Ambassador - this member is a registered Community Ambassador. They were nominated by the Staff Team for the role and elected by the community.</dd>
<dt>PRF-C</dt>
<dd>Proficient/Experienced | Board Certified - this member's proficiency credentials in an IT field have been board certified.</dd>
<dt>EdP-C</dt>
<dd>Educational Services Course | Certified - this member was certified by an Educational Services Instructor by taking one of our courses.</dd>
</dl>
<div class="fixed-bottom">
<footer class="text-center font-weight-light text-monospace">© 2021 Library of Code sp-us | Department of Operations</footer>
<script src="./script.js"></script>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</body>
</html>

View File

@ -1,56 +1,48 @@
(async function() {
const fetched = await fetch('https://loc.sh/int/directory');
//const fetched = await fetch('http://localhost:3890/int/directory');
(async function () {
const fetched = await fetch("https://loc.sh/int/directory");
const data = await fetched.json();
const table = document.getElementById('directory');
const table2 = document.getElementById('roles');
// users.sort((a, b) => a.firstname.localeCompare(b.firstname))
const table = document.getElementById("directory");
let completed = 0;
document.getElementById('loading').innerText += ` ${completed}/${data.length - 1}`
document.getElementById("loading").innerText += ` ${completed}/${
data.length - 1
}`;
for (const info of data.sort((a, b) => a.name.localeCompare(b.name))) {
completed++;
document.getElementById('loading').innerText = `Loading... | ${completed}/${data.length}`;
// console.log(info);
const fetched2 = await fetch(`https://loc.sh/int/directory?id=${info.userID}`);
//const fetched2 = await fetch(`http://localhost:3890/int/directory?id=${info.userID}`);
document.getElementById(
"loading"
).innerText = `Loading... | ${completed}/${data.length}`;
const fetched2 = await fetch(
`https://loc.sh/int/directory?id=${info.userID}`
);
const user = await fetched2.json();
// console.log(user);
if (!user.staff) continue;
const row = table.insertRow();
const row2 = table2.insertRow();
let name = `<strong>${user.username}</strong>`;
let pn = [];
if (info.pn && info.pn.length > 0) {
for (const nominal of info.pn) {
pn.push(`<abbr title="${getAbbreviations().get(nominal)}">${nominal}</abbr>`)
}
name += `, ${pn.join(', ')}`;
}
row.insertCell().innerHTML = `<img src="${user.avatarURL}" alt="${user.username}" style="width:30px;height:30px;"> ${name}`;
// row.insertCell().innerText = `${info.userID} | #${user.discriminator}`;
let departmentAndTitle = '';
row.insertCell().innerHTML = `<img src="${user.avatarURL}" alt="${user.username}" style="width:30px;height:30px;"> ${name} ${info.isManager ? " [k]" : ""}`;
let departmentAndTitle = "";
if (info.title && info.dept) {
departmentAndTitle += `${info.title}, ${info.dept}`;
} else if (info.dept) {
departmentAndTitle += info.dept;
}
row.insertCell().innerText = departmentAndTitle;
row.insertCell().innerHTML = info.emailAddress ? `<a href="mailto:${info.emailAddress}">${info.emailAddress}</a> ` : '';
row.insertCell().innerText = user.pager ? user.pager : '';
row.insertCell().innerText = info.extension ? info.extension : '';
row.insertCell().innerHTML = info.emailAddress
? `<a href="mailto:${info.emailAddress}">${info.emailAddress}</a> `
: "";
row2.insertCell().innerHTML = `${name}`;
let rankings = '<ul>';
let rankings = "<ul>";
if (info.additionalRoles && info.additionalRoles.length > 0) {
for (const rank of info.additionalRoles) {
rankings += `<li>${rank}</li>`
}
rankings += '</ul>';
rankings += `<li>${rank}</li>`;
}
rankings += "</ul>";
} else {
rankings = '';
rankings = "";
}
row2.insertCell().innerHTML = rankings;
}
document.getElementById('loading').style.display = "none";
document.getElementById('directory').style.display = "block";
document.getElementById("loading").style.display = "none";
table.style.display = "block";
})();