Show check-ins per room in "Currently at the PTG" page

Include tooltips on the "Currently at the PTG" page, so that hovering
the mouse over a particular track will show IRC nicks for everyone
currently checked into that track.  If noone has checked in to the
track yet, give a hint about how to do it.

Thanks a lot to Jay Bryant for giving me the idea for this after we
bumped into each other on the plane to Denver ;-)

Change-Id: I1b86c1f403981b066ad096548a1754fadd6b72ad
This commit is contained in:
Adam Spiers 2019-04-27 18:48:05 -06:00
parent 946d69b140
commit a495d3011b
1 changed files with 28 additions and 2 deletions

View File

@ -42,9 +42,19 @@ Handlebars.registerHelper('roomcode',
cell = '<small><i>' + room + "-" + timecode + '</i></small>';
}
} else {
var track = schedule[room][timecode];
var room_checkins = checkins['#' + track];
var title = "No one is checked in here. " +
"DM the bot 'in #" + track + "' to check in.";
if (room_checkins) {
var attendees = room_checkins.map(function(checkin) {
return checkin.nick;
}).sort();
title = 'Checked in here: ' + attendees.join(", ");
}
cell = '<span class="label label-primary ' +
schedule[room][timecode] +
'">' + schedule[room][timecode];
track +
'" title="' + title + '">' + track;
}
}
return new Handlebars.SafeString(cell);
@ -54,8 +64,24 @@ Handlebars.registerHelper('roomcode',
var now = new Date();
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var day = days[ now.getDay() ];
var checkins = {};
$.getJSON("ptg.json", function(json) {
if ('last_check_in' in json) {
// Compile lists of who's checked into each location
for (var attendee in json['last_check_in']) {
var checkin = json['last_check_in'][attendee];
if (checkin.location) {
if (checkin['in'] && ! checkin['out']) {
if (! (checkin.location in checkins)) {
checkins[checkin.location] = [];
}
checkins[checkin.location].push(checkin);
}
}
}
}
json['checkins'] = checkins;
document.getElementById("PTGsessions").innerHTML = template(json);
// if the current day doesn't exist, default to first existing one
if ($('#st'+day).length == 0) {