<%= @tournament.name %> - Matches

<% @tournament.matches.order(:id).reverse.each do |match| %><% end %>
Name Status Winner
<%= "Match #{match.id}" %> <%= match.status %> <%= (match.winner.nil? ? "-" : "Team #{match.winner.id}") %> <%= link_to "Show", tournament_match_path(@tournament, match) %> <%# If user is the host, let them start the tournment %> <% if @tournament.hosts.include?(current_user) %> <%= form_tag(tournament_match_path(@tournament, match), method: "put") do %> <% @startable = (match.status == 0) and (match.teams.count >= @tournament.min_teams_per_match) %> <%= submit_tag("Start Match", :disabled => ! @startable) %> <% end %> <% end %>

<% @tournament.stages_ordered.each do |stage| %>
<%= stage.to_svg %>
<% end %>