summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-06 19:54:48 -0400
committernfoy <nfoy@purdue.edu>2014-04-06 19:54:48 -0400
commite7bf049624246a1248d09c571db31ef26260ae08 (patch)
treefe22ea682512de877630232f71e3c4b5b609096e /app/views
parent2fd131ea6c6a1810d27941d85bcf5a5eb2d8669f (diff)
parentf85943114dba527a1f87abb03229553472f57c0c (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'app/views')
-rw-r--r--app/views/matches/index.html.erb32
-rw-r--r--app/views/matches/show.html.erb4
2 files changed, 29 insertions, 7 deletions
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 219507d..031b2a9 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -26,17 +26,39 @@
<br>
-
+<div id="match-tree">
<SVG version="1.1"
baseProfile="full"
- width="<%= 300 * @matches.count / 2 + 50 %>" height="<%= 200 * @matches.count + 50 %>"
+ width="<%= @width %>" height="<%= @height = [@height, 500].max %>"
xmlns="http://www.w3.org/2000/svg">
-
+ <line x1="300" y1="0" x2="300" y2="<%= @height %>" stroke="black" />
<% (1..@matches.count).each do |i| %>
<g class="svg-match">
- <rect rx="10"
-
+ <rect height="120px" width="213px"
+ x="<%= @width - (i-1)*50 - 250*(Math.log2(i).floor+1) %>"
+ y="<%= (@height/(Math.log2(i).floor+2)) - 60 + 250*(i - 2**(Math.log2(i).floor)) %>"
+ fill="#ffd281"
+ rx="20px"
+ stroke-width="2"
+ <% case @matches[i-1].status %>
+ <% when 0 %>
+ <% if @matches[i-1].teams.count < @tournament.min_teams_per_match %>
+ stroke="red"
+ fill-opacity="0.6"
+ <% else %>
+ stroke="green"
+ <% end %>
+ <% when 1 %>
+ stroke="orange"
+ <% when 2 %>
+ stroke="yellow"
+ <% when 3 %>
+ stroke="grey"
+ <% end %>
+ />
</g>
<% end %>
+
</SVG>
+</div> \ No newline at end of file
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 6fb4042..20860e2 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -61,8 +61,8 @@
Players see the Peer Review Page
Host see the Game Status
-->
-<% if (@match.status==0) %>
- <% if (@tournament.players.include?(current_user) %>
+<% if @match.status == 0 %>
+ <% if @tournament.players.include?(current_user) %>
<% @match.teams.each do |team| %>
<ul>
<% team.users.collect{|u| u.user_name}.each do |k| %>