1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-31 19:45:45 +00:00
Files
wrestlingdev.com/app/views/schools/show.html.erb
jcwimer c0ab1cc56c Remove caching for school show view and eager load correctly
Could not do the caching properly with action buttons having permissions associated. The caching method was being called for every wrestler and took 150ms
2016-01-20 19:58:52 +00:00

77 lines
2.1 KiB
Plaintext

<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}",:class=>"btn btn-default" %>
<% if can? :manage, @school %>
| <%= link_to "Edit #{@school.name}", edit_school_path(@school),:class=>"btn btn-primary" %>
<% end %>
<br>
<br>
<p>
<strong>Name:</strong>
<%= @school.name %>
</p>
<p>
<strong>Team Points Deducted:</strong>
<%= @school.totalDeductedPoints %>
</p>
<p>
<strong>Score:</strong>
<%= @school.score %>
</p>
<p>
<strong>Tournament:</strong>
<%= @school.tournament.name %>
</p>
<br>
<% if can? :manage, @school %>
<%= link_to "New #{@school.name} Wrestler" , "/wrestlers/new?school=#{@school.id}", :class=>"btn btn-success"%>
<% end %>
<br>
<br>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Weight</th>
<th>Seed</th>
<th>Team Points Scored</th>
<th>Extra?</th>
<th>Next Bout/Mat</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @wrestlers.sort_by{|w| w.weight.max}.each do |wrestler| %>
<tr>
<td><%= wrestler.name %></td>
<td><%= wrestler.weight.max %></td>
<td>
<%= wrestler.original_seed %>
</td>
<td><%= wrestler.totalTeamPoints - wrestler.totalDeductedPoints %></td>
<td><% if wrestler.extra? == true %>
Yes
<% end %></td>
<td><%= wrestler.nextMatchBoutNumber %> <%= wrestler.nextMatchMatName %></td>
<td>
<%= link_to 'Show', wrestler , :class=>"btn btn-default btn-sm" %>
<% if can? :manage, wrestler.school %>
<%= link_to 'Edit', edit_wrestler_path(wrestler),:class=>"btn btn-primary btn-sm" %>
<%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>