mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-09 07:39:06 +00:00
Preliminary bracket print page
This commit is contained in:
@@ -42,6 +42,12 @@ class StaticPagesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def all_brackets
|
||||||
|
if params[:tournament]
|
||||||
|
@tournament = Tournament.find(params[:tournament])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def weights
|
def weights
|
||||||
if params[:tournament]
|
if params[:tournament]
|
||||||
@tournament = Tournament.find(params[:tournament])
|
@tournament = Tournament.find(params[:tournament])
|
||||||
|
|||||||
@@ -1,20 +1,29 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<% if params[:print] %>
|
||||||
<head>
|
<head>
|
||||||
<title>Wrestling App</title>
|
<title>Wrestling App</title>
|
||||||
<%= stylesheet_link_tag "application", media: "all",
|
|
||||||
"data-turbolinks-track" => true %>
|
|
||||||
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
||||||
<%= csrf_meta_tags %>
|
|
||||||
<%= render 'layouts/shim' %>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%= render 'layouts/header' %>
|
<%= yield %>
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<%= yield %>
|
|
||||||
<%= render 'layouts/footer' %>
|
|
||||||
<%= debug(params) if Rails.env.development? %>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
|
<% else %>
|
||||||
|
<head>
|
||||||
|
<title>Wrestling App</title>
|
||||||
|
<%= stylesheet_link_tag "application", media: "all",
|
||||||
|
"data-turbolinks-track" => true %>
|
||||||
|
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<%= render 'layouts/shim' %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%= render 'layouts/header' %>
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
<%= render 'layouts/footer' %>
|
||||||
|
<%= debug(params) if Rails.env.development? %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<% end %>
|
||||||
</html>
|
</html>
|
||||||
34
app/views/static_pages/all_brackets.html.erb
Normal file
34
app/views/static_pages/all_brackets.html.erb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<style>
|
||||||
|
.pagebreak { page-break-after: always; width:100%;}
|
||||||
|
#html, #body, #wrapper { width:100%; }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to "Back to #{@tournament.name} weights", "/static_pages/weights?tournament=#{@tournament.id}" %>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
|
||||||
|
<div class="pagebreak">
|
||||||
|
<% @weight = w %>
|
||||||
|
<% @matches = @tournament.upcomingMatches.select{|m| m.weight_id == @weight.id} %>
|
||||||
|
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
|
||||||
|
<h5><%= @weight.max %> lbs Bracket</h5>
|
||||||
|
|
||||||
|
<%= render 'pool' %>
|
||||||
|
</div>
|
||||||
|
<div class="pagebreak">
|
||||||
|
<% if w.pool_bracket_type == "twoPoolsToFinal" %>
|
||||||
|
<%= render 'twoPoolFinalBracket' %>
|
||||||
|
<% end %>
|
||||||
|
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
|
||||||
|
<%= render 'twoPoolSemiBracket' %>
|
||||||
|
<% end %>
|
||||||
|
<% if w.pool_bracket_type == "fourPoolsToQuarter" %>
|
||||||
|
<%= render 'fourPoolQuarterBracket' %>
|
||||||
|
<% end %>
|
||||||
|
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
|
||||||
|
<%= render 'fourPoolSemiBracket' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -5,3 +5,4 @@
|
|||||||
<%= link_to "#{weight.max}" , "/static_pages/brackets?weight=#{weight.id}" %>
|
<%= link_to "#{weight.max}" , "/static_pages/brackets?weight=#{weight.id}" %>
|
||||||
<br>
|
<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= link_to "All Brackets", "/static_pages/all_brackets?print=true&tournament=#{@tournament.id}" %>
|
||||||
@@ -22,6 +22,7 @@ Wrestling::Application.routes.draw do
|
|||||||
# You can have the root of your site routed with "root"
|
# You can have the root of your site routed with "root"
|
||||||
root 'static_pages#index'
|
root 'static_pages#index'
|
||||||
get 'static_pages/brackets'
|
get 'static_pages/brackets'
|
||||||
|
get 'static_pages/all_brackets'
|
||||||
get 'static_pages/weights'
|
get 'static_pages/weights'
|
||||||
get 'admin/index'
|
get 'admin/index'
|
||||||
get 'static_pages/up_matches'
|
get 'static_pages/up_matches'
|
||||||
|
|||||||
Reference in New Issue
Block a user