mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-30 19:22:21 +00:00
Moved team score for faster front page load.
This commit is contained in:
@@ -11,6 +11,17 @@ class StaticPagesController < ApplicationController
|
||||
@matches = @tournament.upcomingMatches
|
||||
end
|
||||
end
|
||||
|
||||
def team_scores
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
end
|
||||
if @tournament
|
||||
@schools = School.where(tournament_id: @tournament.id)
|
||||
@schools.sort_by{|x|[x.score]}
|
||||
end
|
||||
end
|
||||
|
||||
def results
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<li><%= link_to "Brackets" , "/static_pages/weights?tournament=#{@tournament.id}" %></li>
|
||||
<li><%= link_to "Upcoming Matches" , "/static_pages/up_matches?tournament=#{@tournament.id}" %></li>
|
||||
<li><%= link_to "Results" , "/static_pages/results?tournament=#{@tournament.id}" %></li>
|
||||
<li><%= link_to "Team Scores" , "/static_pages/team_scores?tournament=#{@tournament.id}" %></li>
|
||||
<% end %>
|
||||
<% if user_signed_in? %>
|
||||
<li><%= link_to "Log Out", destroy_user_session_path, method: :delete %></li>
|
||||
|
||||
22
app/views/static_pages/team_scores.html.erb
Normal file
22
app/views/static_pages/team_scores.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<h3>Team Scores</h3>
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Score</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @schools.each do |school| %>
|
||||
<tr>
|
||||
<td><%= school.name %></td>
|
||||
<td><%= school.score %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -37,7 +37,6 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Score</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -46,7 +45,6 @@
|
||||
<% @schools.each do |school| %>
|
||||
<tr>
|
||||
<td><%= school.name %></td>
|
||||
<td><%= school.score %></td>
|
||||
<td><%= link_to 'Show', school, :class=>"btn" %>
|
||||
<% if user_signed_in? %>
|
||||
<%= link_to 'Edit', edit_school_path(school), :class=>"btn" %>
|
||||
|
||||
@@ -28,6 +28,7 @@ Wrestling::Application.routes.draw do
|
||||
get 'static_pages/up_matches'
|
||||
get 'static_pages/control_match'
|
||||
get 'static_pages/results'
|
||||
get 'static_pages/team_scores'
|
||||
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
|
||||
Reference in New Issue
Block a user