diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-07 12:43:41 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-07 12:43:41 -0400 |
commit | f11351569b922e7613259aa8968294536f7b41bd (patch) | |
tree | 445b2e9da17e0ce78f97d2f00d1c7e083cb6e625 /app | |
parent | 87d69d44d9d7f56071f34597fd46bd26b59ab9fd (diff) | |
parent | a35fa838565d08d0c6394b943b8fe54b0e56a25e (diff) |
Merge branch 'master' of github.com:LukeShu/leaguer
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/matches.css.scss | 15 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 9 | ||||
-rw-r--r-- | app/views/matches/show.html.erb | 56 |
3 files changed, 62 insertions, 18 deletions
diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss index 3ef9170..84430d6 100644 --- a/app/assets/stylesheets/matches.css.scss +++ b/app/assets/stylesheets/matches.css.scss @@ -24,4 +24,19 @@ text-align: center; padding-top: 10px; background-color: rgb(238, 238, 255); +} + +#match-stats { + padding-bottom: 10px; + border-bottom: thick dashed #F0AD4E; +} + +#match-winner { + margin: 0 auto; + text-align: center; + font-size: 2em; +} + +#current-id { + display: none; }
\ No newline at end of file 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 %> <defs> - <radialGradient id="gradMatch" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> + <radialGradient id="gradMatch" cx="50%" cy="50%" r="80%" fx="80%" fy="80%"> <stop offset="0%" style="stop-color:#ffd281; stop-opacity:0" /> - <stop offset="100%" style="stop-color:#EEA236;stop-opacity:1" /> + <stop offset="100%" style="stop-color:#ccc;stop-opacity:1" /> </radialGradient> </defs> <script type="text/ecmascript"><![CDATA[ @@ -55,6 +55,7 @@ } ]]> </script> + <% (1..@matches.count).each do |i| %> <g id="svg-match-<%= i %>" onclick="redirect(<%= @matches[i-1].id %>)" cursor="pointer"> <rect height="<%= rh = 100/(2**(@depth-1)+1) - 5 %>%" @@ -80,7 +81,7 @@ stroke="grey" <% end %> /> - <rect width="<%= rw-5 %>%" height="<%= rh/4 %>%" x="<%= rx + 2.5 %>%" y="<%= ry + rh/6 %>%" fill="<%= @matches[i-1].teams.first and @matches[i-1].teams.first.users.include?(current_user) ? "#BCED91" : "white" %>" stroke="black" /> + <rect width="<%= rw-5 %>%" height="<%= rh/4 %>%" x="<%= rx + 2.5 %>%" y="<%= ry + rh/6 %>%" fill="<%= @matches[i-1].teams.first and @matches[i-1].teams.first.users.include?(current_user) ? "#BCED91" : "white" %>" /> <text x="<%= rx + rw/4 %>%" y="<%= ry + rh/3 %>%" font-size="<%= rh %>"> <% if @matches[i-1].teams.first %> Team <%= @matches[i-1].teams.first.id %> @@ -88,7 +89,7 @@ </text> <text x="<%= rx + 1.3*rw/3 %>%" y="<%= ry + 5.2*rh/9 %>%" font-size="<%= rh %>"> VS </text> - <rect width="<%= rw-5 %>%" height="<%= rh/4 %>%" x="<%= rx + 2.5 %>%" y="<%= ry + 3*rh/5 %>%" fill="<%= @matches[i-1].teams[1] and @matches[i-1].teams[1].users.include?(current_user) ? "#BCED91" : "white" %>" stroke="black" /> + <rect width="<%= rw-5 %>%" height="<%= rh/4 %>%" x="<%= rx + 2.5 %>%" y="<%= ry + 3*rh/5 %>%" fill="<%= @matches[i-1].teams[1] and @matches[i-1].teams[1].users.include?(current_user) ? "#BCED91" : "white" %>" /> <text x="<%= rx + rw/4 %>%" y="<%= ry + 4*rh/5 %>%" font-size="<%= rh %>"> <% 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 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> |