1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-19 05:43:17 +00:00

Added logic to delegate tournament access

This commit is contained in:
2016-01-06 18:38:02 +00:00
parent eb9037b078
commit f46029efaf
46 changed files with 417 additions and 121 deletions

View File

@@ -1,6 +1,6 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Back to browse tournaments', '/tournaments', :class=>"btn btn-default" %>
<% if tournament_permissions(@tournament) %>
<% if can? :manage, @tournament %>
| <%= link_to "Edit #{@tournament.name}", edit_tournament_path(@tournament), :class=>"btn btn-primary" %>
<% end %>
@@ -34,12 +34,12 @@
<br>
<h3>School Lineups</h3>
<br>
<% if tournament_permissions(@tournament) %>
<%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<% if can? :manage, @tournament %>
<%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}", :class=>"btn btn-success btn-sm" %>
<br>
<br>
<% end %>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
@@ -52,10 +52,10 @@
<% @schools.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= link_to 'Show', school, :class=>"btn btn-default" %>
<% if tournament_permissions(@tournament) %>
<%= link_to 'Edit', edit_school_path(school), :class=>"btn btn-primary" %>
<%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<td><%= link_to 'Show', school, :class=>"btn btn-default btn-sm" %>
<% if can? :manage, @tournament %>
<%= link_to 'Edit', edit_school_path(school), :class=>"btn btn-primary btn-sm" %>
<%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>
</tr>
@@ -68,12 +68,12 @@
<h3>Weight Class Seeds</h3>
<br>
<% if tournament_permissions(@tournament) %>
<%= link_to "New #{@tournament.name} Weight" , "/weights/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<% if can? :manage, @tournament %>
<%= link_to "New #{@tournament.name} Weight" , "/weights/new?tournament=#{@tournament.id}", :class=>"btn btn-success btn-sm" %>
<br>
<br>
<% end %>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Weight Class</th>
@@ -87,10 +87,10 @@
<tr>
<td><%= weight.max %></td>
<td><%= weight.bracket_size %></td>
<td><%= link_to 'Show', weight, :class=>"btn btn-default" %>
<% if tournament_permissions(@tournament) %>
<%= link_to 'Edit', edit_weight_path(weight), :class=>"btn btn-primary" %>
<%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<td><%= link_to 'Show', weight, :class=>"btn btn-default btn-sm" %>
<% if can? :manage, @tournament %>
<%= link_to 'Edit', edit_weight_path(weight), :class=>"btn btn-primary btn-sm" %>
<%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>
</tr>
@@ -98,15 +98,15 @@
</tbody>
</table>
<% if tournament_permissions(@tournament) %>
<% if can? :manage, @tournament %>
<br>
<br>
<h3>Mats</h3>
<br>
<%= link_to "New #{@tournament.name} Mat" , "/mats/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<%= link_to "New #{@tournament.name} Mat" , "/mats/new?tournament=#{@tournament.id}", :class=>"btn btn-success btn-sm" %>
<br>
<br>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
@@ -119,9 +119,9 @@
<tr>
<td><%= mat.name %></td>
<td>
<% if tournament_permissions(@tournament) %>
<%= link_to 'Show', mat, :class=>"btn btn-default" %>
<%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% if can? :manage, @tournament %>
<%= link_to 'Show', mat, :class=>"btn btn-default btn-sm" %>
<%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>
</tr>