summaryrefslogtreecommitdiff
path: root/app/views/tournaments/show.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tournaments/show.html.erb')
-rw-r--r--app/views/tournaments/show.html.erb27
1 files changed, 11 insertions, 16 deletions
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index 7e3fbae..07c1c6b 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,3 +1,5 @@
+<%= link_to '« Back to all tournaments', tournaments_path, class: :breadcrumb %>
+
<h2 id="tournament-name">
<%= @tournament.name %>
</h2>
@@ -72,33 +74,26 @@
<% end %>
</div>
-<div class="leave-buttons">
- <%# If user can join, and user hasn't joined already, show the join tournment tag %>
+<div class="actions">
+ <%# If user can join, and user hasn't joined already, show a join tournment button %>
<% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %>
- <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <%= form_tag(tournament_path(@tournament), method: "put", role: :button) do %>
<input type="hidden" name="update_action" value="join">
<%= submit_tag("Join Tournament") %>
<% end %>
<% elsif @tournament.players.include?(current_user) %>
- <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <%= form_tag(tournament_path(@tournament), method: "put", role: :button) do %>
<input type="hidden" name="update_action" value="leave">
<%= submit_tag("Leave Tournament") %>
<% end %>
<% end %>
-
<%# If user is the host, let them start the tournment %>
- <% if @tournament.hosts.include?(current_user) %>
- <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <% if @tournament.check_permission(current_user, :edit) %>
+ <%= form_tag(tournament_path(@tournament), method: "put", role: :button) do %>
<input type="hidden" name="update_action" value="start">
- <% 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 %>
+ <%= submit_tag("Start Tournament", disabled: (@tournament.players.count < @tournament.min_players_per_team * @tournament.min_teams_per_match)) %>
<% end %>
- <%= link_to 'Edit', edit_tournament_path(@tournament) %> |
- <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= link_to 'Edit Tournament', edit_tournament_path(@tournament), role: :button %>
+ <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' }, role: :button %>
<% end %>
</div>
-
-<%= link_to 'Back', tournaments_path %>