mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-09 23:44:52 +00:00
Added 16 man modified double elimination bracket type. Still need to fix swap wrestlers code.
This commit is contained in:
22
app/views/tournaments/_bracket_director_actions.html.erb
Normal file
22
app/views/tournaments/_bracket_director_actions.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<% if can? :manage, @tournament %>
|
||||
<h3>Tournament Director Bracket Actions</h3>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Swap Bracket Position</strong>
|
||||
<%= form_for(Wrestler.new, url: swap_wrestlers_path(@tournament)) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label 'Wrestler 1' %><br>
|
||||
<%= f.collection_select :originalId, @weight.wrestlers, :id, :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label 'Wrestler 2' %><br>
|
||||
<%= f.collection_select :swapId, @weight.wrestlers, :id, :name %>
|
||||
</div>
|
||||
<br>
|
||||
<%= submit_tag "Swap", :class=>"btn btn-success"%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
95
app/views/tournaments/_bracket_partial.html.erb
Normal file
95
app/views/tournaments/_bracket_partial.html.erb
Normal file
@@ -0,0 +1,95 @@
|
||||
<style>
|
||||
table.smallText tr td { font-size: 10px; }
|
||||
/*
|
||||
* Bracket Layout Specifics
|
||||
*/
|
||||
main {
|
||||
display:flex;
|
||||
}
|
||||
|
||||
.round {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
width: 145px;
|
||||
list-style:none;
|
||||
padding:0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.game + li {
|
||||
flex-grow:1;
|
||||
}
|
||||
|
||||
li:first-child,li:last-child {
|
||||
flex-grow:.5;
|
||||
}
|
||||
|
||||
.game {
|
||||
padding-left:5px;
|
||||
}
|
||||
|
||||
.winner {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.game span {
|
||||
float:right;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
.game-top {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.game-top + li {
|
||||
border-right:1px solid #aaa; min-height:5px;
|
||||
}
|
||||
|
||||
.bout-number {
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
}
|
||||
.bracket-winner {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.game-bottom {
|
||||
border-bottom:1px solid #aaa; border-right:1px solid #aaa;
|
||||
}
|
||||
</style>
|
||||
<table class='smallText'>
|
||||
<h5><strong><%= @tournament.name %> - <%= @weight.max %> lbs 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' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "twoPoolsToSemi" %>
|
||||
<%= render 'twoPoolSemiBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "eightPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToSemi" %>
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% elsif @tournament.tournament_type == "Modified 16 Man Double Elimination" %>
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<%= render 'modified_sixteen_man_double_elimination_bracket' %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,131 @@
|
||||
<h4>Championship Bracket</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-1">
|
||||
<% @matches.select{|m|m.bracket_position == "Bracket" and m.round == 1}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name_round_one %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name_round_one %><span></span></li>
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-2">
|
||||
<% @matches.select{|m|m.bracket_position == "Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-5">
|
||||
<li></li>
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
1st
|
||||
<li></li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
<h4>3/4 place match</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<li> </li>
|
||||
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
3rd
|
||||
|
||||
<li> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
<h4>Consolation Bracket</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-1">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso" and m.round == 2}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
<li> </li>
|
||||
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-2">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<% @matches.select{|m|m.bracket_position == "5/6"}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-5">
|
||||
<li> </li>
|
||||
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
5th
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
@@ -1,104 +1,26 @@
|
||||
<% cache ["#{@tournament.id}_all_brackets", @tournament] do %>
|
||||
|
||||
<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;
|
||||
position: relative;
|
||||
left: 0in;
|
||||
height: 1in;
|
||||
}
|
||||
/*
|
||||
* Bracket Layout Specifics
|
||||
*/
|
||||
main, ul {
|
||||
display:flex;
|
||||
}
|
||||
|
||||
ul {
|
||||
flex-direction:column;
|
||||
width: 125px;
|
||||
list-style:none;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.game + li {
|
||||
flex-grow:1;
|
||||
}
|
||||
|
||||
li:first-child,li:last-child {
|
||||
flex-grow:.5;
|
||||
}
|
||||
|
||||
.game {
|
||||
padding-left:5px;
|
||||
}
|
||||
|
||||
.winner {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.game span {
|
||||
float:right;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
.game-top {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.game-top + li {
|
||||
border-right:1px solid #aaa; min-height:60px;
|
||||
}
|
||||
|
||||
.bracket-winner {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.bout-number {
|
||||
text-align: center;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.game-bottom {
|
||||
border-top:1px solid #aaa;
|
||||
}
|
||||
</style>
|
||||
|
||||
<% cache ["#{@tournament.id}_all_brackets", @tournament] do %>
|
||||
<div id="exportable">
|
||||
<%= render :file => 'tournaments/team_scores' %>
|
||||
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
|
||||
<% @tournament.weights.sort_by{|w| w.max}.each do |weight| %>
|
||||
<table class='pagebreak'>
|
||||
<h5><strong><%= @tournament.name %> - <%= w.max %> lbs Bracket</strong></h5>
|
||||
<tr>
|
||||
<td valign="top" style="padding: 0px;">
|
||||
<% @weight = w %>
|
||||
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
|
||||
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
|
||||
<% @pools = w.pool_rounds(@matches) %>
|
||||
<%= render 'pool' %>
|
||||
</td>
|
||||
|
||||
|
||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<% if w.pool_bracket_type == "twoPoolsToFinal" %>
|
||||
<%= render 'twoPoolFinalBracket' %>
|
||||
<% end %>
|
||||
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
|
||||
<%= render 'twoPoolSemiBracket' %>
|
||||
<% end %>
|
||||
<% if w.pool_bracket_type == "fourPoolsToQuarter" or w.pool_bracket_type == "eightPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
<!-- 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 == "Modified 16 Man 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 %>
|
||||
|
||||
@@ -1,95 +1,8 @@
|
||||
<style>
|
||||
table.smallText tr td { font-size: 10px; }
|
||||
/*
|
||||
* Bracket Layout Specifics
|
||||
*/
|
||||
main {
|
||||
display:flex;
|
||||
}
|
||||
|
||||
.round {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
width: 145px;
|
||||
list-style:none;
|
||||
padding:0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.game + li {
|
||||
flex-grow:1;
|
||||
}
|
||||
|
||||
li:first-child,li:last-child {
|
||||
flex-grow:.5;
|
||||
}
|
||||
|
||||
.game {
|
||||
padding-left:5px;
|
||||
}
|
||||
|
||||
.winner {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.game span {
|
||||
float:right;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
.game-top {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.game-top + li {
|
||||
border-right:1px solid #aaa; min-height:60px;
|
||||
}
|
||||
|
||||
.bout-number {
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.bracket-winner {
|
||||
border-bottom:1px solid #aaa;
|
||||
}
|
||||
|
||||
.game-bottom {
|
||||
border-top:1px solid #aaa;
|
||||
}
|
||||
</style>
|
||||
<% cache ["#{@weight.id}_bracket", @weight] do %>
|
||||
<table class='smallText'>
|
||||
<h5><strong><%= @tournament.name %> - <%= @weight.max %> lbs Bracket</strong></h5>
|
||||
<tr>
|
||||
<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' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "twoPoolsToSemi" %>
|
||||
<%= render 'twoPoolSemiBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "eightPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToSemi" %>
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= render 'bracket_partial' %>
|
||||
<% end %>
|
||||
|
||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||
<%= render 'pool_bracket_director_actions' %>
|
||||
<% elsif @tournament.tournament_type == "Modified 16 Man Double Elimination" %>
|
||||
<%= render 'bracket_director_actions' %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user