summaryrefslogtreecommitdiff
path: root/app/views/tournaments/show.html.erb
diff options
context:
space:
mode:
authorTomer Kimia <tkimia@purdue.edu>2014-04-01 17:14:05 -0400
committerTomer Kimia <tkimia@purdue.edu>2014-04-01 17:14:05 -0400
commit0867bc68749873aa131c0f3b273771b5f70ae778 (patch)
treed29a091054b4ac659af77072f55be1e7b1bf69cf /app/views/tournaments/show.html.erb
parentcd6b94cfc989800d65acc0fbceeebe35da5be4af (diff)
players can now leave tournaments
Diffstat (limited to 'app/views/tournaments/show.html.erb')
-rw-r--r--app/views/tournaments/show.html.erb16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index cc0f0e3..df85dcf 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -71,10 +71,17 @@
<input type="hidden" name="update_action" value="join">
<%= submit_tag("Join Tournamnet") %>
<% end %>
+
+<% elsif @tournament.players.include?(current_user) %>
+ <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <input type="hidden" name="update_action" value="leave">
+ <%= 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 %>
<input type="hidden" name="close_action" value="close">
<% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %>
@@ -83,9 +90,12 @@
<%= submit_tag("Start Tournament", disabled: true) %>
<% end %>
<br />
- <%= link_to 'Edit', edit_tournament_path(@tournament) %> |
- <%= link_to 'Back', tournaments_path %>
-<% 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 %>
</div>