From 0ea678daa091529750cbc9786734db8e1d165bd2 Mon Sep 17 00:00:00 2001 From: tkimia Date: Mon, 7 Apr 2014 11:25:24 -0400 Subject: ajax support in match show --- app/views/matches/index.html.erb | 9 +++++---- app/views/matches/show.html.erb | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'app/views') diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 15b59f4..08d5fd6 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -43,10 +43,10 @@ lastrh = 0 lastrw = 0 %> - + - + + <% (1..@matches.count).each do |i| %> /> - " stroke="black" /> + " /> <% if @matches[i-1].teams.first %> Team <%= @matches[i-1].teams.first.id %> @@ -88,7 +89,7 @@ VS - " stroke="black" /> + " /> <% if @matches[i-1].teams[1] %> Team <%= @matches[i-1].teams[1].id %> 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 @@

Status: - <%= @match.status %> + <%= @match.status %>

Tournament: @@ -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); -- cgit v1.2.3-2-g168b From 22098c2551f02c170cfe62a124477eba4c80c044 Mon Sep 17 00:00:00 2001 From: tkimia Date: Mon, 7 Apr 2014 11:52:29 -0400 Subject: small visual changes to show --- app/views/matches/show.html.erb | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'app/views') diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 16345ab..1f14e05 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,16 +1,29 @@ -

- Status: - <%= @match.status %> -

-

- Tournament: - <%= @match.tournament.id %> -

+
+
+ Status: + <% case @match.status %> + <% when 0 %> + Match Not Started + <% when 1 %> + Match in Progress + <% when 2 %> + Peer Review in Progress + <% when 3 %> + Finished + <% end %> + <%= @match.status %> + +
+
+ Tournament: + <%= @match.tournament.name %> +
-

- Name: - <%= @match.name %> -

+
+ Name: + <%= @match.name %> +
+