summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/matches/show.html.erb14
-rw-r--r--app/views/tournaments/_selected.html.erb2
-rw-r--r--app/views/tournaments/index.html.erb2
3 files changed, 15 insertions, 3 deletions
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index e95cd07..b31c989 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,6 +1,6 @@
<p>
<strong>Tournament:</strong>
- <%= @match.tournament %>
+ <%= @match.tournament.id %>
</p>
<p>
@@ -8,5 +8,17 @@
<%= @match.name %>
</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 %>
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
index 925e127..9b1b7f8 100644
--- a/app/views/tournaments/_selected.html.erb
+++ b/app/views/tournaments/_selected.html.erb
@@ -4,7 +4,7 @@
<% @chosen = Game.find_by(params[:game]) %>
<% @tournament.attributes.each do |name, value| %>
- <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "statuss") %>
+ <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") %>
<% next %>
<% end %>
<p>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 452d939..d4ef414 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -21,7 +21,7 @@
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
- <td><%= tournament.game %></td>
+ <td><%= tournament.id %></td>
<td><%= tournament.status %></td>
<td><%= tournament.min_players_per_team %></td>
<td><%= tournament.max_players_per_team %></td>