diff options
author | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-07 03:48:51 -0400 |
---|---|---|
committer | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-07 03:48:51 -0400 |
commit | f20dc8df17187027c1881803dbc72b1d3802ff1a (patch) | |
tree | 32c71a2fa178d439f9b0720a59287832f3945a6b /app/views/matches/index.html.erb | |
parent | 0da3155cc44e257fdcaae81c9dd7f2a38d5389df (diff) |
Tournament advancement stuff. IT'S 4 AM
Diffstat (limited to 'app/views/matches/index.html.erb')
-rw-r--r-- | app/views/matches/index.html.erb | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 80d12ab..6c93321 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -11,24 +11,23 @@ </tr> </thead> - <tbody class="table-hover"> - <% @tournament.matches.order(:id).reverse.each do |match| %> - <tr> - <td><%= match.name %></td> - <td><%= match.status %></td> - <td><%= (match.winner.nil? ? "-" : "Team #{match.winner.id}") %></td> - <td><%= link_to "Show", tournament_match_path(@tournament, match) %> - <td> <%# 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 %> - <input type="hidden" name="update_action" value="start"> - <%= submit_tag("Start Match", :dissabled => match.teams.count < @tournament.min_teams_per_match) %> - <% end %> - <% end %> -</div></td> - </tr> - <% end %> - </tbody> + <tbody class="table-hover"> + <% @tournament.matches.order(:id).reverse.each do |match| %><tr> + <td><%= match.name %></td> + <td><%= match.status %></td> + <td><%= (match.winner.nil? ? "-" : "Team #{match.winner.id}") %></td> + <td><%= link_to "Show", tournament_match_path(@tournament, match) %> + <td> <%# 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 %> + <input type="hidden" name="update_action" value="start"> + <% @startable = (match.status == 0) and (match.teams.count >= @tournament.min_teams_per_match) %> + <%= submit_tag("Start Match", :disabled => ! @startable) %> + <% end %> + <% end %> + </td> + </tr><% end %> + </tbody> </table> <br> |