1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/app/views/tournaments/bracket.html.erb

141 lines
3.8 KiB
Plaintext

<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>
<% end %>
<% 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>
<td>
<strong>Move wrestler to pool with a bye</strong>
<%= form_tag '/wrestlers/update_pool' do %>
<div class="field">
<%= label_tag 'Wrestler to move' %><br>
<%= collection_select(:wrestler, :id, @weight.wrestlers, :id, :name) %>
</div>
<div class="field">
<%= label_tag 'Pool to move to' %><br>
<%= select :wrestler, :pool, @weight.pools_with_bye %>
</div>
<br>
<%= submit_tag "Move", :class=>"btn btn-success"%>
<% end %>
</td>
<td>
<strong>Rerun getting pool placement</strong>
<p>If you changed the result of a match that changes the ranking of a pool.</p>
<%= form_tag "/weights/#{@weight.id}/pool_order", :method => :post do %>
<div class="field">
<%= label_tag 'Pool to place' %><br>
<%= select_tag :pool_to_order, options_for_select((1..@weight.pools).step(1).to_a) %>
</div>
<br>
<%= submit_tag "Get Pool Placement", :class=>"btn btn-success"%>
<% end %>
</td>
</tr>
</table>
<% end %>