Display count of attendees in each room on web page

Currently it's not obvious that you can see who's checked into a room
by hovering the mouse over one of the room badges. This in turn makes
it less likely for people to check in, since they either won't be
aware of the feature, or will forget about it.

So game-ify check-ins by adding a new column to the "Current
discussion topics" table which displays the number of check-ins within
that room.

Story: 2005657
Task: 30945
Change-Id: I8d2bc716d39c70ff096f17b4da9ccf0a26bfc34f
This commit is contained in:
Adam Spiers 2019-05-10 11:05:10 +01:00
parent 21a616df07
commit 8a4910d904
2 changed files with 23 additions and 0 deletions

View File

@ -41,6 +41,7 @@
<td class="col-sm-1">{{trackbadge 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>
<td>{{checkins track}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{else}} {{else}}

View File

@ -32,6 +32,28 @@ Handlebars.registerHelper('roomactive',
return false; return false;
}); });
Handlebars.registerHelper('checkins', function(track) {
var count = checkins_count(track);
var url = "https://opendev.org/openstack/ptgbot/src/branch/master/README.rst";
var text;
var title = "See below or click for how to check in/out";
if (count == 0) {
text = 'No check-ins';
} else {
text = count + ' check-in' + (count == 1 ? '' : 's');
title = checkins_tooltip(track) + ".\n\n" + title + '.';
}
return new Handlebars.SafeString(
'<a href="' + url + '" target="blank" class="checkins" title="'
+ title + '">' + text + '</a>'
);
});
function checkins_count(track) {
var room_checkins = checkins['#' + track];
return room_checkins ? Object.keys(room_checkins).length : 0;
}
function checkins_tooltip(track) { function checkins_tooltip(track) {
var room_checkins = checkins['#' + track]; var room_checkins = checkins['#' + track];
if (room_checkins) { if (room_checkins) {