From 52cf873619c8ca0cfd51eaae994f2056beffde2c Mon Sep 17 00:00:00 2001 From: sirDonovan Date: Fri, 30 Oct 2015 09:09:12 -0500 Subject: [PATCH] Tournaments: support showing users who have joined During signups in elimination tournaments, show the number of users who have joined in place of the empty bracket --- js/client-chat-tournament.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/client-chat-tournament.js b/js/client-chat-tournament.js index ada6f1ddf..c151a0805 100644 --- a/js/client-chat-tournament.js +++ b/js/client-chat-tournament.js @@ -551,8 +551,14 @@ TournamentBox.prototype.generateBracket = function (data) { if (data.type === 'tree') { - if (!data.rootNode) - return; + var $div = $('
'); + + if (!data.rootNode) { + if (!('users' in data)) return; + var users = data.users.length; + if (users) $div.html('' + users + ' user' + (users !== 1 ? 's' : '') + ':
' + data.users.join(", ")); + return $div; + } var name = app.user.get('name'); var nodeSize = { @@ -561,8 +567,6 @@ separationX: 30, separationY: 15 }; - var $div = $('
'); - var nodesByDepth = []; var stack = [{node: data.rootNode, depth: 0}]; while (stack.length > 0) {