diff options
Diffstat (limited to 'app/views/matches/show.html.erb')
-rw-r--r-- | app/views/matches/show.html.erb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index c92aea3..6be3481 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,6 +1,6 @@ <p> <strong>Status:</strong> - <%= @match.status %> + <span id="current-id"> <%= @match.status %></span> </p> <p> <strong>Tournament:</strong> @@ -127,4 +127,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> |