Add attendees tooltip to now/next track badges

Add the attendees tooltip to the now/next track badges, not just the
ones in the schedule timetable lower down.

Change-Id: Ibb92b1c520c6eebf78dabc0a052dd52fc5a40855
This commit is contained in:
Adam Spiers 2019-05-02 11:59:51 -06:00
parent b14ec32f05
commit 66f261c710
2 changed files with 28 additions and 15 deletions

View File

@ -38,7 +38,7 @@
{{#each tracks as |track| }} {{#each tracks as |track| }}
{{#if (lookup @root.now track) }} {{#if (lookup @root.now track) }}
<tr> <tr>
<td class="col-sm-1"><span class="label label-primary {{track}}">{{track}}</span></td> <td class="col-sm-1">{{trackbadge track}}</span></td>
<td>{{#trackContentLine}}{{lookup @root.now track}}{{/trackContentLine}}</td> <td>{{#trackContentLine}}{{lookup @root.now track}}{{/trackContentLine}}</td>
<td>{{lookup @root.location track}}</td> <td>{{lookup @root.location track}}</td>
</tr> </tr>
@ -59,7 +59,7 @@
{{#each tracks as |track| }} {{#each tracks as |track| }}
{{#if (lookup @root.next track) }} {{#if (lookup @root.next track) }}
<tr> <tr>
<td class="col-sm-1"><span class="label label-primary {{track}}">{{track}}</span></td> <td class="col-sm-1">{{trackbadge track}}</span></td>
<td> <td>
{{#each (lookup @root.next track) as |item|}} {{#each (lookup @root.next track) as |item|}}
{{#trackContentLine}}{{item}}{{/trackContentLine}} <br/> {{#trackContentLine}}{{item}}{{/trackContentLine}} <br/>

View File

@ -31,6 +31,31 @@ Handlebars.registerHelper('roomactive',
return false; return false;
}); });
function checkins_tooltip(track) {
var room_checkins = checkins['#' + track];
if (room_checkins) {
var attendees = room_checkins.map(function(checkin) {
return checkin.nick;
}).sort();
return 'Checked in here: ' + attendees.join(", ");
} else {
return "No one is checked in here. " +
"DM the bot 'in #" + track + "' to check in.";
}
}
function track_badge(track) {
var title = checkins_tooltip(track);
return '<span class="label label-primary ' +
track +
'" title="' + title + '">' + track;
}
Handlebars.registerHelper('trackbadge',
function(track) {
return new Handlebars.SafeString(track_badge(track));
});
Handlebars.registerHelper('roomcode', Handlebars.registerHelper('roomcode',
function(schedule, room, timecode, s) { function(schedule, room, timecode, s) {
var cell = ''; var cell = '';
@ -42,19 +67,7 @@ Handlebars.registerHelper('roomcode',
cell = '<small><i>' + room + "-" + timecode + '</i></small>'; cell = '<small><i>' + room + "-" + timecode + '</i></small>';
} }
} else { } else {
var track = schedule[room][timecode]; cell = track_badge(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 ' +
track +
'" title="' + title + '">' + track;
} }
} }
return new Handlebars.SafeString(cell); return new Handlebars.SafeString(cell);