mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 06:28:33 +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
|
@matches = @tournament.upcomingMatches
|
||||||
end
|
end
|
||||||
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
|
def results
|
||||||
if params[:tournament]
|
if params[:tournament]
|
||||||
@tournament = Tournament.find(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 "Brackets" , "/static_pages/weights?tournament=#{@tournament.id}" %></li>
|
||||||
<li><%= link_to "Upcoming Matches" , "/static_pages/up_matches?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 "Results" , "/static_pages/results?tournament=#{@tournament.id}" %></li>
|
||||||
|
<li><%= link_to "Team Scores" , "/static_pages/team_scores?tournament=#{@tournament.id}" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li><%= link_to "Log Out", destroy_user_session_path, method: :delete %></li>
|
<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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Score</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -46,7 +45,6 @@
|
|||||||
<% @schools.each do |school| %>
|
<% @schools.each do |school| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= school.name %></td>
|
<td><%= school.name %></td>
|
||||||
<td><%= school.score %></td>
|
|
||||||
<td><%= link_to 'Show', school, :class=>"btn" %>
|
<td><%= link_to 'Show', school, :class=>"btn" %>
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<%= link_to 'Edit', edit_school_path(school), :class=>"btn" %>
|
<%= 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/up_matches'
|
||||||
get 'static_pages/control_match'
|
get 'static_pages/control_match'
|
||||||
get 'static_pages/results'
|
get 'static_pages/results'
|
||||||
|
get 'static_pages/team_scores'
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
# get 'products/:id' => 'catalog#view'
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|||||||
Reference in New Issue
Block a user