<%= @tournament.name %>

<%= tag("div", {:id => "prog-bar", :class => "progress-bar progress-bar-warning", :style => "width: " +(@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s + "%", "aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => (@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s, "role" => "progressbar"}) %> 60% Complete (warning)

<%= pluralize(@tournament.players.count, "player has", "players have") %> signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed.

Status: <% if @tournament.status == 0 %> Waiting for players... <% else %> Started <% end %>

Min players per team: <%= @tournament.min_players_per_team %>

Max players per team: <%= @tournament.max_players_per_team %>

Min teams per match: <%= @tournament.min_teams_per_match %>

Max teams per match: <%= @tournament.max_teams_per_match %>

Set rounds: <%= @tournament.set_rounds %>

Min players per team: <%= @tournament.min_players_per_team %>

Max players per team: <%= @tournament.max_players_per_team %>

Min teams per match: <%= @tournament.min_teams_per_match %>

Max teams per match: <%= @tournament.max_teams_per_match %>

Set rounds: <%= @tournament.set_rounds %>

Randomized teams: <%= @tournament.randomized_teams %>

<%# Show all players in the tournament %> <% if @tournament.players.length > 0 %>

Players Here:

<% else %>

Hmmm.... nobody's here yet! You and your friends should join the tournament.

<% end %>
<%# If user can join, and user hasn't joined already, show the join tournment tag %> <% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %> <%= form_tag(tournament_path(@tournament), method: "put") do %> <%= submit_tag("Join Tournamnet") %> <% end %> <% elsif @tournament.players.include?(current_user) %> <%= form_tag(tournament_path(@tournament), method: "put") do %> <%= submit_tag("Leave Tournamnet") %> <% end %> <% end %> <%# If user is the host, let them start the tournment %> <% if @tournament.hosts.include?(current_user) %> <%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %> <%= submit_tag("Start Tournament") %> <% else %> <%= submit_tag("Start Tournament", disabled: true) %> <% end %>
<%= link_to 'Edit', edit_tournament_path(@tournament) %> | <%= link_to 'Back', tournaments_path %> | <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %> <% end %>
<%end %>