1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Cache other pages that users will frequent

This commit is contained in:
2015-12-23 15:29:32 +00:00
parent b0640a61a7
commit a3cf41918b
4 changed files with 121 additions and 115 deletions

View File

@@ -1,76 +1,78 @@
<p id="notice"><%= notice %></p>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}",:class=>"btn btn-default" %>
<% if tournament_permissions(@school.tournament) %>
| <%= 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>Score:</strong>
<%= @school.score %>
</p>
<p>
<strong>Tournament:</strong>
<%= Tournament.find(@school.tournament_id).name %>
</p>
<br>
<% if tournament_permissions(@school.tournament) %>
<%= 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">
<thead>
<tr>
<th>Name</th>
<th>Weight</th>
<th>Seed</th>
<th>Record</th>
<th>Seed Criteria</th>
<th>Team Points Scored</th>
<th>Extra?</th>
<th>Next Bout/Mat</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @wrestlers.order("weight_id asc").each do |wrestler| %>
<% if wrestler.school_id == @school.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= Weight.find(wrestler.weight_id).max %></td>
<td>
<%= wrestler.original_seed %>
</td>
<td><%= wrestler.season_win %>-<%= wrestler.season_loss %></td>
<td><%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>%</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" %>
<% if tournament_permissions(@school.tournament) %>
<%= link_to 'Edit', edit_wrestler_path(wrestler),:class=>"btn btn-primary" %>
<%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
</td>
</tr>
<% cache ["schools", @school] do %>
<p id="notice"><%= notice %></p>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}",:class=>"btn btn-default" %>
<% if tournament_permissions(@school.tournament) %>
| <%= 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>Score:</strong>
<%= @school.score %>
</p>
<p>
<strong>Tournament:</strong>
<%= Tournament.find(@school.tournament_id).name %>
</p>
<br>
<% if tournament_permissions(@school.tournament) %>
<%= 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">
<thead>
<tr>
<th>Name</th>
<th>Weight</th>
<th>Seed</th>
<th>Record</th>
<th>Seed Criteria</th>
<th>Team Points Scored</th>
<th>Extra?</th>
<th>Next Bout/Mat</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @wrestlers.order("weight_id asc").each do |wrestler| %>
<% if wrestler.school_id == @school.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= Weight.find(wrestler.weight_id).max %></td>
<td>
<%= wrestler.original_seed %>
</td>
<td><%= wrestler.season_win %>-<%= wrestler.season_loss %></td>
<td><%= wrestler.criteria %> Win <%= wrestler.seasonWinPercentage %>%</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" %>
<% if tournament_permissions(@school.tournament) %>
<%= link_to 'Edit', edit_wrestler_path(wrestler),:class=>"btn btn-primary" %>
<%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</tbody>
</table>
<% end %>