mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-24 17:04: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;
|
||||
}
|
||||
</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'>
|
||||
<h5><strong><%= @tournament.name %> - <%= @weight.max %> Bracket</strong></h5>
|
||||
<tr>
|
||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
|
||||
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
|
||||
<% @pools = @weight.pool_rounds(@matches) %>
|
||||
<%= render 'pool' %>
|
||||
</td>
|
||||
|
||||
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<% if @weight.pool_bracket_type == "twoPoolsToFinal" %>
|
||||
<%= render 'twoPoolFinalBracket' %>
|
||||
@@ -106,14 +106,18 @@ table.smallText tr td { font-size: 10px; }
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
</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>
|
||||
</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="bracket">
|
||||
<div class="page">
|
||||
<div class="bracket-container">
|
||||
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||
<h4>Championship Bracket</h4>
|
||||
<div class="bracket">
|
||||
<% if @weight.highest_bracket_round %>
|
||||
<% (1..@weight.highest_bracket_round).each do |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"} %>
|
||||
<% @winner_place = "1st" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h4>Consolation Bracket</h4>
|
||||
<div class="bracket">
|
||||
<div class="page-landscape">
|
||||
<div class="bracket-container">
|
||||
<h4><%= @tournament.name %> - <%= @weight.max %> Bracket</h4>
|
||||
<h4>Consolation Bracket</h4>
|
||||
<div class="bracket">
|
||||
<% if @weight.highest_conso_round %>
|
||||
<% (1..@weight.highest_conso_round).each do |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"} %>
|
||||
<% @winner_place = "3rd" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<h4>5/6 place match</h4>
|
||||
<div class="bracket">
|
||||
</div>
|
||||
<h4>5/6 place match</h4>
|
||||
<div class="bracket">
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "5/6"} %>
|
||||
<% @winner_place = "5th" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<% if @tournament.number_of_placers >= 8 %>
|
||||
</div>
|
||||
<% if @tournament.number_of_placers >= 8 %>
|
||||
<h4>7/8 place match</h4>
|
||||
<div class="bracket">
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "7/8"} %>
|
||||
<% @winner_place = "7th" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,11 @@
|
||||
<% @round = 1 %>
|
||||
<% @pool = 1 %>
|
||||
<% 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>
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<thead>
|
||||
|
||||
@@ -1,43 +1,76 @@
|
||||
<style>
|
||||
.pagebreak {
|
||||
page-break-after: always;
|
||||
border: none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 8in; /* width: 7in; */
|
||||
height: 9.5in; /* or height: 9.5in; */
|
||||
font-size: 8px;
|
||||
@page {
|
||||
size: 8.5in 11in;
|
||||
margin: 0.5in;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 7.5in;
|
||||
height: 10in;
|
||||
margin: auto;
|
||||
overflow: hidden;
|
||||
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>
|
||||
|
||||
<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 %>
|
||||
<div id="exportable" >
|
||||
<div class="page">
|
||||
<div class="bracket-container">
|
||||
<%= render :template => 'tournaments/team_scores' %>
|
||||
</div>
|
||||
</div>
|
||||
<% @weights.sort_by{|w| w.max}.each do |weight| %>
|
||||
<table class='pagebreak'>
|
||||
<tr>
|
||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<!-- Need to define what the tournaments#bracket controller defines -->
|
||||
<% @matches = @tournament.matches.select{|m| m.weight_id == weight.id} %>
|
||||
<% @wrestlers = Wrestler.where(weight_id: weight.id) %>
|
||||
<% @pools = weight.pool_rounds(@matches) %>
|
||||
<% @weight = weight %>
|
||||
<%= render 'bracket_partial' %>
|
||||
</td>
|
||||
<% 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 -->
|
||||
<% @matches = weight.matches %>
|
||||
<% @weight = weight %>
|
||||
<%= render 'bracket_partial' %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user