diff options
Diffstat (limited to 'app/views/matches/show.html.erb')
-rw-r--r-- | app/views/matches/show.html.erb | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 34a7432..1f14e05 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,16 +1,29 @@ -<p> - <strong>Status:</strong> - <%= @match.status %> -</p> -<p> - <strong>Tournament:</strong> - <%= @match.tournament.id %> -</p> +<div class="row" id="match-stats"> + <div class="col-md-4 col-sm-3 "> + <strong>Status:</strong> + <% case @match.status %> + <% when 0 %> + Match Not Started + <% when 1 %> + Match in Progress + <% when 2 %> + Peer Review in Progress + <% when 3 %> + Finished + <% end %> + <span id="current-id"> <%= @match.status %></span> + + </div> + <div class="col-md-4 col-sm-3"> + <strong>Tournament:</strong> + <%= @match.tournament.name %> + </div> -<p> - <strong>Name:</strong> - <%= @match.name %> -</p> + <div class="col-md-4 col-sm-3"> + <strong>Name:</strong> + <%= @match.name %> + </div> +</div> <!-- Match Status 0 => Created, waiting to start Match Status 1 => Match is running, waiting to finish @@ -45,8 +58,8 @@ </div> <% unless @match.winner.nil? %> - <p> - <strong>Winner:</strong> + <p id="match-winner"> + <strong>Winning Team:</strong> <%= @match.winner.users.collect{|u| u.user_name}.join(", ") %> </p> <% end %> @@ -127,4 +140,19 @@ function score_peers() { $('review_action').value += $('ol#boxes:eq(' + i + ')').text() + comma; } } + + +function donehandle( match ) { + if ( console && console.log ) { + } + + //if match has moved on in status, reload the page. + if (parseInt($("#current-id").text()) != match["status"]) + window.location.reload(true); + + setTimeout(function(){$.ajax({url: "<%= request.original_url %>.json"}).done(donehandle)}, 2000); +} + +$.ajax({url: "<%= request.original_url %>.json"}) + .done(donehandle); </script> |