Browse Source

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
changes/40/656840/1
Adam Spiers 2 years ago
parent
commit
66f261c710
2 changed files with 28 additions and 15 deletions
  1. +2
    -2
      html/ptg.html
  2. +26
    -13
      html/ptg.js

+ 2
- 2
html/ptg.html View File

@ -38,7 +38,7 @@
{{#each tracks as |track| }}
{{#if (lookup @root.now track) }}
<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>{{lookup @root.location track}}</td>
</tr>
@ -59,7 +59,7 @@
{{#each tracks as |track| }}
{{#if (lookup @root.next track) }}
<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>
{{#each (lookup @root.next track) as |item|}}
{{#trackContentLine}}{{item}}{{/trackContentLine}} <br/>


+ 26
- 13
html/ptg.js View File

@ -31,6 +31,31 @@ Handlebars.registerHelper('roomactive',
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',
function(schedule, room, timecode, s) {
var cell = '';
@ -42,19 +67,7 @@ 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 ' +
track +
'" title="' + title + '">' + track;
cell = track_badge(schedule[room][timecode]);
}
}
return new Handlebars.SafeString(cell);


Loading…
Cancel
Save