summaryrefslogtreecommitdiff
path: root/app/views/tournaments/show.html.erb
diff options
context:
space:
mode:
authortkimia <tkimia@purdue.edu>2014-04-03 16:45:05 -0400
committertkimia <tkimia@purdue.edu>2014-04-03 16:45:05 -0400
commitdacab01db3ac4b9d9e2281daff74230a003f138e (patch)
treefe85ee0e664f52f06e36d4ee014416a3bea292be /app/views/tournaments/show.html.erb
parent9236bc8f79bf18f7aa9802090c53536fe20108bb (diff)
small change in form (Set Rounds no longer viewable). AJAX fixed so that start tournament button enables or disables based on players here.
Diffstat (limited to 'app/views/tournaments/show.html.erb')
-rw-r--r--app/views/tournaments/show.html.erb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index b771701..d246f7a 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -134,11 +134,18 @@ function donehandle( tournament ) {
$("#prog-bar").width( (pct_complete * 100) +"%");
$("#players-needed").text(here + " " + (here==1?"player has":"players have") + " signed up. " + needed + " players needed. ");
players = "";
+
+ //creates the present user list
for (var i = 0; i < tournament["players"].length; i++) {
players = players+"<li><span class=\"black\">"+tournament["players"][i]["user_name"]+"</span></li>"
}
+
+ //updates the user list
$("#tournament-users").html(players);
+ //if there are enough players to start, enable the button, else disable it.
+ $("input[value=\"Start Tournament\"]").prop('disabled', (pct_complete >= 1)? false : true);
+
}
setTimeout(function(){$.ajax({url: "<%= url_for @tournament %>.json"}).done(donehandle)}, 3000);
}