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

125 lines
3.2 KiB
Plaintext

<style>
/*
* Bracket Layout Specifics
*/
main {
display:flex;
}
.round {
display:flex;
flex-direction:column;
width: 100px;
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:30px;
}
.bracket-winner {
border-bottom:1px solid #aaa;
}
.game-bottom {
border-top:1px solid #aaa;
}
</style>
<% cache ["#{@weight.id}_bracket", @weight] do %>
</br>
</br>
</br>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<table class='pagebreak'>
<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 %>
<br><br>
<h3>Swap Bracket Position</h3>
<%= 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 %>
<% end %>
<% if can? :manage, @tournament %>
<br><br>
<h3>Move wrestler to pool with a bye</h3>
<%= 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 %>
<% end %>