summaryrefslogtreecommitdiff
path: root/app/views/matches/show.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/matches/show.html.erb')
-rw-r--r--app/views/matches/show.html.erb29
1 files changed, 22 insertions, 7 deletions
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 3abb1f7..d8112b7 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,8 +1,6 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>Tournament:</strong>
- <%= @match.tournament %>
+ <%= @match.tournament.id %>
</p>
<p>
@@ -10,10 +8,27 @@
<%= @match.name %>
</p>
-<p>
- <strong>Winner:</strong>
- <%= @match.winner %>
-</p>
+<% if @tournament.hosts.include?(current_user) %>
+ <%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %>
+ <ul>
+ <% @match.teams.each do |team| %>
+ <li><label><input type="radio" name="winner" value="<%= team.id %>">
+ <%= team.users.collect{|u| u.user_name}.join(", ") %></label></li>
+ <% end %>
+ </ul>
+ <%= submit_tag("Select winner") %>
+ <% end %>
+<% end %>
+<%= link_to 'Edit', edit_tournament_match_path(@tournament, @match) %> |
+<%= link_to 'Back', tournament_matches_path %>
+
+<% unless @match.winner.nil? %>
+ <p>
+ <strong>Winner:</strong>
+ <%= @match.winner.users.collect{|u| u.user_name}.join(", ") %>
+ </p>
+<% end %>
<%= link_to 'Edit', edit_match_path(@match) %> |
<%= link_to 'Back', matches_path %>
+