mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Fix all brackets printable view.
This commit is contained in:
@@ -77,18 +77,18 @@ table.smallText tr td { font-size: 10px; }
|
|||||||
min-height: 12px;
|
min-height: 12px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||||
|
<div class="page">
|
||||||
|
<div class="bracket-container">
|
||||||
|
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||||
<table class='smallText'>
|
<table class='smallText'>
|
||||||
<h5><strong><%= @tournament.name %> - <%= @weight.max %> Bracket</strong></h5>
|
|
||||||
<tr>
|
<tr>
|
||||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
|
||||||
<td valign="top" style="padding: 10px;">
|
<td valign="top" style="padding: 10px;">
|
||||||
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
|
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
|
||||||
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
|
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
|
||||||
<% @pools = @weight.pool_rounds(@matches) %>
|
<% @pools = @weight.pool_rounds(@matches) %>
|
||||||
<%= render 'pool' %>
|
<%= render 'pool' %>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td valign="top" style="padding: 10px;">
|
<td valign="top" style="padding: 10px;">
|
||||||
<% if @weight.pool_bracket_type == "twoPoolsToFinal" %>
|
<% if @weight.pool_bracket_type == "twoPoolsToFinal" %>
|
||||||
<%= render 'twoPoolFinalBracket' %>
|
<%= render 'twoPoolFinalBracket' %>
|
||||||
@@ -106,14 +106,18 @@ table.smallText tr td { font-size: 10px; }
|
|||||||
<%= render 'fourPoolSemiBracket' %>
|
<%= render 'fourPoolSemiBracket' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" %>
|
|
||||||
<td valign="top" style="padding: 10px;">
|
|
||||||
<%= render 'modified_sixteen_man_double_elimination_bracket' %>
|
|
||||||
</td>
|
|
||||||
<% elsif @tournament.tournament_type.include? "Regular Double Elimination" %>
|
|
||||||
<td valign="top" style="padding: 10px;">
|
|
||||||
<%= render 'double_elimination_bracket' %>
|
|
||||||
</td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" %>
|
||||||
|
<div class="page">
|
||||||
|
<div class="bracket-container">
|
||||||
|
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||||
|
<%= render 'modified_sixteen_man_double_elimination_bracket' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% elsif @tournament.tournament_type.include? "Regular Double Elimination" %>
|
||||||
|
<%= render 'double_elimination_bracket' %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
<h4>Championship Bracket</h4>
|
<div class="page">
|
||||||
<div class="bracket">
|
<div class="bracket-container">
|
||||||
|
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||||
|
<h4>Championship Bracket</h4>
|
||||||
|
<div class="bracket">
|
||||||
<% if @weight.highest_bracket_round %>
|
<% if @weight.highest_bracket_round %>
|
||||||
<% (1..@weight.highest_bracket_round).each do |round| %>
|
<% (1..@weight.highest_bracket_round).each do |round| %>
|
||||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Bracket" and m.round == round} %>
|
<% @round_matches = @matches.select{|m|m.bracket_position == "Bracket" and m.round == round} %>
|
||||||
@@ -13,9 +16,14 @@
|
|||||||
<% @final_match = @matches.select{|m|m.bracket_position == "1/2"} %>
|
<% @final_match = @matches.select{|m|m.bracket_position == "1/2"} %>
|
||||||
<% @winner_place = "1st" %>
|
<% @winner_place = "1st" %>
|
||||||
<%= render 'bracket_final' %>
|
<%= render 'bracket_final' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4>Consolation Bracket</h4>
|
<div class="page-landscape">
|
||||||
<div class="bracket">
|
<div class="bracket-container">
|
||||||
|
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||||
|
<h4>Consolation Bracket</h4>
|
||||||
|
<div class="bracket">
|
||||||
<% if @weight.highest_conso_round %>
|
<% if @weight.highest_conso_round %>
|
||||||
<% (1..@weight.highest_conso_round).each do |round| %>
|
<% (1..@weight.highest_conso_round).each do |round| %>
|
||||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Conso" and m.round == round} %>
|
<% @round_matches = @matches.select{|m|m.bracket_position == "Conso" and m.round == round} %>
|
||||||
@@ -29,18 +37,20 @@
|
|||||||
<% @final_match = @matches.select{|m|m.bracket_position == "3/4"} %>
|
<% @final_match = @matches.select{|m|m.bracket_position == "3/4"} %>
|
||||||
<% @winner_place = "3rd" %>
|
<% @winner_place = "3rd" %>
|
||||||
<%= render 'bracket_final' %>
|
<%= render 'bracket_final' %>
|
||||||
</div>
|
</div>
|
||||||
<h4>5/6 place match</h4>
|
<h4>5/6 place match</h4>
|
||||||
<div class="bracket">
|
<div class="bracket">
|
||||||
<% @final_match = @matches.select{|m|m.bracket_position == "5/6"} %>
|
<% @final_match = @matches.select{|m|m.bracket_position == "5/6"} %>
|
||||||
<% @winner_place = "5th" %>
|
<% @winner_place = "5th" %>
|
||||||
<%= render 'bracket_final' %>
|
<%= render 'bracket_final' %>
|
||||||
</div>
|
</div>
|
||||||
<% if @tournament.number_of_placers >= 8 %>
|
<% if @tournament.number_of_placers >= 8 %>
|
||||||
<h4>7/8 place match</h4>
|
<h4>7/8 place match</h4>
|
||||||
<div class="bracket">
|
<div class="bracket">
|
||||||
<% @final_match = @matches.select{|m|m.bracket_position == "7/8"} %>
|
<% @final_match = @matches.select{|m|m.bracket_position == "7/8"} %>
|
||||||
<% @winner_place = "7th" %>
|
<% @winner_place = "7th" %>
|
||||||
<%= render 'bracket_final' %>
|
<%= render 'bracket_final' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<% @round = 1 %>
|
<% @round = 1 %>
|
||||||
<% @pool = 1 %>
|
<% @pool = 1 %>
|
||||||
<% until @wrestlers.select{|w| w.pool == @pool}.blank? %>
|
<% until @wrestlers.select{|w| w.pool == @pool}.blank? %>
|
||||||
|
<!-- Add another column for pools 5-8 on an 8 pool -->
|
||||||
|
<% if @pool == 5 %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% end %>
|
||||||
<h5>Pool <%= @pool %></h5>
|
<h5>Pool <%= @pool %></h5>
|
||||||
<table class="table table-striped table-bordered table-condensed">
|
<table class="table table-striped table-bordered table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -1,43 +1,76 @@
|
|||||||
<style>
|
<style>
|
||||||
.pagebreak {
|
@page {
|
||||||
page-break-after: always;
|
size: 8.5in 11in;
|
||||||
border: none;
|
margin: 0.5in;
|
||||||
margin: 0px;
|
}
|
||||||
padding: 0px;
|
|
||||||
width: 8in; /* width: 7in; */
|
.page {
|
||||||
height: 9.5in; /* or height: 9.5in; */
|
width: 7.5in;
|
||||||
font-size: 8px;
|
height: 10in;
|
||||||
|
margin: auto;
|
||||||
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 0in;
|
}
|
||||||
height: 1in;
|
|
||||||
|
.page-landscape {
|
||||||
|
height: 7.5in;
|
||||||
|
width: 10in;
|
||||||
|
margin: auto;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bracket-container {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
transform-origin: top left;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.page {
|
||||||
|
page-break-after: always;
|
||||||
|
}
|
||||||
|
.page-landscape {
|
||||||
|
page-break-after: always;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onload = function () {
|
||||||
|
document.querySelectorAll('.page').forEach(page => {
|
||||||
|
const container = page.querySelector('.bracket-container');
|
||||||
|
const isLandscape = page.classList.contains('landscape');
|
||||||
|
const availableWidth = isLandscape ? 10 * 96 : 7.5 * 96; // Convert inches to px
|
||||||
|
const availableHeight = isLandscape ? 7.5 * 96 : 10 * 96;
|
||||||
|
|
||||||
|
const scaleX = availableWidth / container.scrollWidth;
|
||||||
|
const scaleY = availableHeight / container.scrollHeight;
|
||||||
|
const scale = Math.min(scaleX, scaleY); // Choose the smaller scale to fit
|
||||||
|
container.style.transform = `scale(${scale})`;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
<% cache ["#{@tournament.id}_all_brackets", @tournament] do %>
|
<% cache ["#{@tournament.id}_all_brackets", @tournament] do %>
|
||||||
<div id="exportable" >
|
<div class="page">
|
||||||
|
<div class="bracket-container">
|
||||||
<%= render :template => 'tournaments/team_scores' %>
|
<%= render :template => 'tournaments/team_scores' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% @weights.sort_by{|w| w.max}.each do |weight| %>
|
<% @weights.sort_by{|w| w.max}.each do |weight| %>
|
||||||
<table class='pagebreak'>
|
|
||||||
<tr>
|
|
||||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||||
<td valign="top" style="padding: 10px;">
|
|
||||||
<!-- Need to define what the tournaments#bracket controller defines -->
|
<!-- Need to define what the tournaments#bracket controller defines -->
|
||||||
<% @matches = @tournament.matches.select{|m| m.weight_id == weight.id} %>
|
<% @matches = @tournament.matches.select{|m| m.weight_id == weight.id} %>
|
||||||
<% @wrestlers = Wrestler.where(weight_id: weight.id) %>
|
<% @wrestlers = Wrestler.where(weight_id: weight.id) %>
|
||||||
<% @pools = weight.pool_rounds(@matches) %>
|
<% @pools = weight.pool_rounds(@matches) %>
|
||||||
<% @weight = weight %>
|
<% @weight = weight %>
|
||||||
<%= render 'bracket_partial' %>
|
<%= render 'bracket_partial' %>
|
||||||
</td>
|
|
||||||
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" or @tournament.tournament_type.include? "Regular Double Elimination" %>
|
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" or @tournament.tournament_type.include? "Regular Double Elimination" %>
|
||||||
<td valign="top" style="padding: 10px;">
|
|
||||||
<!-- Need to define what the tournaments#bracket controller defines -->
|
<!-- Need to define what the tournaments#bracket controller defines -->
|
||||||
<% @matches = weight.matches %>
|
<% @matches = weight.matches %>
|
||||||
<% @weight = weight %>
|
<% @weight = weight %>
|
||||||
<%= render 'bracket_partial' %>
|
<%= render 'bracket_partial' %>
|
||||||
</td>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
Reference in New Issue
Block a user