summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 23:57:54 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 23:57:54 -0400
commitcd0c7d73be76feffbaaea9200c485b2316604469 (patch)
tree9c708335a46b96c3a0c257a964f51fe88d023a0e /app/views
parent7297cff5b674a61fd57ccc46eb75173011bd205c (diff)
parent40c112d42922c14063759d381f834724f22a340d (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views')
-rw-r--r--app/views/brackets/show.html.erb20
-rw-r--r--app/views/common/_show_tournament.html.erb5
2 files changed, 16 insertions, 9 deletions
diff --git a/app/views/brackets/show.html.erb b/app/views/brackets/show.html.erb
index a3eb000..24b19fe 100644
--- a/app/views/brackets/show.html.erb
+++ b/app/views/brackets/show.html.erb
@@ -1,7 +1,8 @@
<h2><%= @bracket.name %></h2>
-<h4> Make your prediction for the tournament by clicking on the teams you think will win </h4>
-
+<% if !@results %>
+ <h4> Make your prediction for the tournament by clicking on the teams you think will win </h4>
+<% end %>
<svg id="prediction-svg" version="1.1" baseProfile="full"
xmlns="http://www.w3.org/2000/svg"
@@ -71,7 +72,7 @@
while t <= @numTeams %>
<rect width="<%= rw-5 %>%" height="<%= rh*Float(30)/(@matchHeight) %>%" x="<%= rx + 2.5 %>%" y="<%= ry + (Float(t-1)/@numTeams)*rh + 1 %>%" fill="white" />
<text id="svg-match-<%= i %>-team-<%= t-1 %>" x="<%= rx + rw/4 %>%" y="<%= ry + (Float(t-1)/@numTeams + Float(33)/(@matchHeight))*rh %>%" font-size="150%"
- <% if @matches[i].teams[t-1] %>
+ <% if @matches[i].teams[t-1] && !@results %>
onclick="chooseWinner(<%= @matches[i].id%>, <%= @matches[i].teams[t-1].id %>)"
<% end %>
>
@@ -97,12 +98,13 @@
<% end %>
</SVG>
-<%= form_tag(tournament_bracket_path(@tournament, @bracket), method: 'put') do %>
- <input type="hidden" name="update_action" value="predict">
- <% for i in 1..@matches.length %>
- <%= hidden_field_tag("bracket[matches][#{@matches[i].id.to_s}]", value = nil) %>
+<% if !@results %>
+ <%= form_tag(tournament_bracket_path(@tournament, @bracket), method: 'put') do %>
+ <input type="hidden" name="update_action" value="predict">
+ <% for i in 1..@matches.length %>
+ <%= hidden_field_tag("bracket[matches][#{@matches[i].id.to_s}]", value = nil) %>
+ <% end %>
+ <%= submit_tag("Submit Prediction", disabled: true, id: "bracket-submit") %>
<% end %>
- <%= submit_tag("Submit Prediction", disabled: true, id: "bracket-submit") %>
<% end %>
-
<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
index f4d02ec..c0237b1 100644
--- a/app/views/common/_show_tournament.html.erb
+++ b/app/views/common/_show_tournament.html.erb
@@ -38,6 +38,11 @@
<%= form_tag(tournament_brackets_path(target), method: "post") do %>
<%= submit_tag("Make Bracket") %>
<% end %>
+ <% elsif @user_bracket && target.status == 4 %>
+ <%= form_tag(tournament_bracket_path(@tournament, @bracket), method: 'put') do %>
+ <input type="hidden" name="update_action" value="results">
+ <%= submit_tag("Bracket Results") %>
+ <% end %>
<% end %>
<% end %>
</div>