diff options
author | tkimia <tkimia@purdue.edu> | 2014-04-07 11:25:24 -0400 |
---|---|---|
committer | tkimia <tkimia@purdue.edu> | 2014-04-07 11:25:24 -0400 |
commit | 0ea678daa091529750cbc9786734db8e1d165bd2 (patch) | |
tree | 3b454eb1f2c051d219fa0f1bbf801b84cf48fa2e /app/views/matches/show.html.erb | |
parent | c8b4045ba1ca02e750d6e8b15a1ced47b1930217 (diff) |
ajax support in match show
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> |