diff options
Diffstat (limited to 'app/views/tournaments/show.html.erb')
-rw-r--r-- | app/views/tournaments/show.html.erb | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index b771701..b654804 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -40,35 +40,6 @@ <%= @tournament.max_teams_per_match %> </p> -<p> - <strong>Set rounds:</strong> - <%= @tournament.set_rounds %> -</p> - -<p> - <strong>Min players per team:</strong> - <%= @tournament.min_players_per_team %> -</p> - -<p> - <strong>Max players per team:</strong> - <%= @tournament.max_players_per_team %> -</p> - -<p> - <strong>Min teams per match:</strong> - <%= @tournament.min_teams_per_match %> -</p> - -<p> - <strong>Max teams per match:</strong> - <%= @tournament.max_teams_per_match %> -</p> - -<p> - <strong>Set rounds:</strong> - <%= @tournament.set_rounds %> -</p> <p> <strong>Randomized teams:</strong> @@ -108,8 +79,8 @@ <%# If user is the host, let them start the tournment %> <% if @tournament.hosts.include?(current_user) %> - <%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> - <input type="hidden" name="close_action" value="close"> + <%= form_tag(tournament_path(@tournament), method: "put") do %> + <input type="hidden" name="update_action" value="start"> <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %> <%= submit_tag("Start Tournament") %> <% else %> @@ -134,13 +105,22 @@ 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); + + if (tournament["status"] == 1) + window.location.reload(true); } - setTimeout(function(){$.ajax({url: "<%= url_for @tournament %>.json"}).done(donehandle)}, 3000); + setTimeout(function(){$.ajax({url: "<%= url_for @tournament %>.json"}).done(donehandle)}, 2000); } $.ajax({url: "<%= url_for @tournament %>.json"}) |