1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-10 23:53:06 +00:00

Finished setting owner for tournamenr and protecting paths

This commit is contained in:
2015-10-26 16:31:45 -04:00
parent ad9ea9dc42
commit d18e729012
16 changed files with 109 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
<p id="notice"><%= notice %></p>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}",:class=>"btn btn-default" %> |
<% if user_signed_in? %>
<% if tournament_permissions(@school.tournament) %>
<%= link_to "Edit #{@school.name}", edit_school_path(@school),:class=>"btn btn-primary" %>
<% end %>
<br>
@@ -25,7 +25,7 @@
<br>
<% if user_signed_in? %>
<% if tournament_permissions(@school.tournament) %>
<%= link_to "New #{@school.name} Wrestler" , "/wrestlers/new?school=#{@school.id}", :class=>"btn btn-success"%>
<% end %>
<br>
@@ -40,7 +40,7 @@
<th>Record</th>
<th>Seed Criteria</th>
<th>Extra?</th>
<% if user_signed_in? %>
<% if tournament_permissions(@school.tournament) %>
<th>Actions</th>
<% end %>
</tr>
@@ -60,7 +60,7 @@
<td><% if wrestler.extra? == true %>
Yes
<% end %></td>
<% if user_signed_in? %>
<% if tournament_permissions(@school.tournament) %>
<td>
<%= link_to 'Show', wrestler , :class=>"btn btn-default" %>
<%= link_to 'Edit', edit_wrestler_path(wrestler), :class=>"btn btn-default" %>

View File

@@ -23,7 +23,7 @@
<tr>
<td><%= tournament.name %></td>
<td><%= link_to 'Show', tournament, :class=>"btn btn-default" %>
<% if user_signed_in? %>
<% if tournament_permissions(tournament) %>
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary" %>
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>

View File

@@ -7,7 +7,7 @@
<br>
<% end %>
<br>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= form_for(@tournament) do |f| %>
<div class="field">
<%= f.label :weigh_in_ref %><br>
@@ -56,8 +56,8 @@
</tbody>
</table>
<%= hidden_field_tag :tournament, @tournament_id %>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= submit_tag "Save", :class=>"btn btn-success"%>
<% end %>
<% end %>
<% end %>
<% end %>

View File

@@ -31,9 +31,9 @@
<%= f.label :tournament_type %><br>
<%= f.select :tournament_type, @tournament.tournament_types %>
</div>
<%= f.hidden_field :user_id, :value => current_user.id %>
<br>
<br>
<%= f.hidden_field :user_id, :value => current_user.id %>
<div class="actions">
<%= f.submit 'Submit',:class=>"btn btn-success" %>
</div>

View File

@@ -1,8 +1,8 @@
<p id="notice"><%= notice %></p>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to "Edit #{@tournament.name}", edit_tournament_path(@tournament), :class=>"btn btn-primary" %> |
<% end %>
<%= link_to 'Back', root_path, :class=>"btn btn-default" %>
<%= link_to 'Back', '/static_pages/tournaments', :class=>"btn btn-default" %>
<h1>
<%= @tournament.name %>
@@ -30,7 +30,7 @@
<%= @tournament.tournament_type %>
</p>
<br>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to "Generate Pool Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}", data: { confirm: 'Are you sure? This will delete all current matches.' }, :class=>"btn btn-success" %>
<br><br>
<%= link_to "Weigh In Page" , "/static_pages/weigh_in?tournament=#{@tournament.id}", :class=>"btn btn-primary" %>
@@ -40,7 +40,7 @@
<br>
<h3>School Lineups</h3>
<br>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to "New #{@tournament.name} School" , "/schools/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<br>
<br>
@@ -59,7 +59,7 @@
<tr>
<td><%= school.name %></td>
<td><%= link_to 'Show', school, :class=>"btn btn-default" %>
<% if user_signed_in? %>
<% 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" %>
<% end %>
@@ -74,7 +74,7 @@
<h3>Weight Class Seeds</h3>
<br>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to "New #{@tournament.name} Weight" , "/weights/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<br><br>
<%= link_to "Create HS Weights" , "/static_pages/createCustomWeights?tournament=#{@tournament.id}&customValue=hs",data: { confirm: 'Are you sure? This will delete all current weights.' }, :class=>"btn btn-success" %>
@@ -96,7 +96,7 @@
<td><%= weight.max %></td>
<td><%= weight.bracket_size %></td>
<td><%= link_to 'Show', weight, :class=>"btn btn-default" %>
<% if user_signed_in? %>
<% 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" %>
<% end %>
@@ -106,7 +106,7 @@
</tbody>
</table>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<br>
<br>
<h3>Mats</h3>
@@ -127,7 +127,7 @@
<tr>
<td><%= mat.name %></td>
<td>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
</td>

View File

@@ -3,7 +3,7 @@
<h1>Weight Class:<%= @weight.max %></h1>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %> |
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= link_to "Edit #{@weight.max} Weight Class", edit_weight_path(@weight), :class=>"btn btn-primary" %>
<% end %>
@@ -19,7 +19,7 @@
<th>Record</th>
<th>Seed Criteria</th>
<th>Extra?</th>
<% if user_signed_in? %><th>Actions for wrestler</th><% end %>
<% if tournament_permissions(@tournament) %><th>Actions for wrestler</th><% end %>
</tr>
</thead>
<tbody>
@@ -30,7 +30,7 @@
<td><%= wrestler.name %></td>
<td><%= School.find(wrestler.school_id).name %></td>
<td>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= fields_for "wrestler[]", wrestler do |w| %>
<%= w.text_field :original_seed %>
<% end %>
@@ -43,7 +43,7 @@
<td><% if wrestler.extra? == true %>
Yes
<% end %></td>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<td><%= link_to 'Show', wrestler , :class=>"btn btn-default" %>
<%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' } , :class=>"btn btn-danger" %></td>
<% end %>
@@ -52,7 +52,7 @@
<% end %>
</tbody>
</table>
<% if user_signed_in? %>
<% if tournament_permissions(@tournament) %>
<%= submit_tag "Save", :class=>"btn btn-success"%>
<% end %>
<% end %>

View File

@@ -1,7 +1,7 @@
<p id="notice"><%= notice %></p>
<%= link_to "Back to #{@school.name}", "/schools/#{@school.id}" %> |
<% if user_signed_in? %>
<% if tournament_permissions(@wrestler.tournament) %>
<%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler) %> |
<% end %>