1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-06 22:44:14 +00:00

Moved static pages actions to tournament where it made sense

This commit is contained in:
2015-11-05 02:38:39 +00:00
parent f86a577c8b
commit 4fae1c2896
21 changed files with 240 additions and 324 deletions

View File

@@ -1,201 +0,0 @@
<style>
/*
* Flex Layout Specifics
*/
main{
display:flex;
flex-direction:row;
}
.round{
display:flex;
flex-direction:column;
justify-content:center;
width:200px;
list-style:none;
padding:0;
}
.round .spacer{ flex-grow:1; }
.round .spacer:first-child,
.round .spacer:last-child{ flex-grow:.5; }
.round .game-spacer{
flex-grow:1;
}
/*
* General Styles
*/
body{
font-family:sans-serif;
font-size:small;
padding:10px;
line-height:1.4em;
}
li.game{
padding-left:20px;
}
li.game.winner{
font-weight:bold;
}
li.game span{
float:right;
margin-right:5px;
}
li.game-top{ border-bottom:1px solid #aaa; }
li.game-spacer{
border-right:1px solid #aaa;
min-height:40px;
}
li.game-bottom{
border-top:1px solid #aaa;
}
</style>
<h5>Championship Bracket After Pool</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-2">
<% @matches.select{|m|m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-3">
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.winnerName %> <span></span></li>
1st
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>
<h5>3rd/4th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
3rd
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>
<h5>Consolation Bracket After Pool</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-2">
<% @matches.select{|m|m.bracket_position == "5/6"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
5th
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
<br>
<h5>7th/8th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "7/8"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.winnerName %> <span></span></li>
7th
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>

View File

@@ -1,192 +0,0 @@
<style>
/*
* Flex Layout Specifics
*/
main{
display:flex;
flex-direction:row;
}
.round{
display:flex;
flex-direction:column;
justify-content:center;
width:200px;
list-style:none;
padding:0;
}
.round .spacer{ flex-grow:1; }
.round .spacer:first-child,
.round .spacer:last-child{ flex-grow:.5; }
.round .game-spacer{
flex-grow:1;
}
/*
* General Styles
*/
body{
font-family:sans-serif;
font-size:small;
padding:10px;
line-height:1.4em;
}
li.game{
padding-left:20px;
}
li.game.winner{
font-weight:bold;
}
li.game span{
float:right;
margin-right:5px;
}
li.game-top{ border-bottom:1px solid #aaa; }
li.game-spacer{
border-right:1px solid #aaa;
min-height:40px;
}
li.game-bottom{
border-top:1px solid #aaa;
}
</style>
<h5>Championship Bracket After Pool</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-2">
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
1st
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>
<h5>3rd/4th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
3rd
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>
<h5>Consolation Bracket After Pool</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-2">
<% @matches.select{|m|m.bracket_position == "5/6"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
5th
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
<br>
<h5>7th/8th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "7/8"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
7th
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>

View File

@@ -1,35 +0,0 @@
<% @round = 1 %>
<% @pool = 1 %>
<% until @wrestlers.select{|w| w.generatePoolNumber == @pool}.blank? %>
<h5>Pool <%= @pool %></h5>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<% until @matches.select{|m| m.round == @round}.blank? %>
<% if @round <= @pools %>
<th>R<%= @round %></th>
<% end %>
<% @round = @round + 1 %>
<% end %>
</tr>
</thead>
<tbody>
<% @wrestlers.select{|w| w.generatePoolNumber == @pool}.sort_by{|w| w.original_seed}.each do |w| %>
<tr>
<td><%= w.original_seed %> <%= w.name %> <%= w.season_win %>-<%= w.season_loss %> <%= w.school.name %></td>
<% @round = 1 %>
<% until @matches.select{|m| m.round == @round}.blank? %>
<% if @round <= @pools %>
<td><%= w.boutByRound(@round) %><br><%= w.resultByBout(w.boutByRound(@round)) %></td>
<% end %>
<% @round = @round + 1 %>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% @pool = @pool + 1 %>
<% @round = 1 %>
<% end %>

View File

@@ -1,109 +0,0 @@
<style>
/*
* Flex Layout Specifics
*/
main{
display:flex;
flex-direction:row;
}
.round{
display:flex;
flex-direction:column;
justify-content:center;
width:200px;
list-style:none;
padding:0;
}
.round .spacer{ flex-grow:1; }
.round .spacer:first-child,
.round .spacer:last-child{ flex-grow:.5; }
.round .game-spacer{
flex-grow:1;
}
/*
* General Styles
*/
body{
font-family:sans-serif;
font-size:small;
padding:10px;
line-height:1.4em;
}
li.game{
padding-left:20px;
}
li.game.winner{
font-weight:bold;
}
li.game span{
float:right;
margin-right:5px;
}
li.game-top{ border-bottom:1px solid #aaa; }
li.game-spacer{
border-right:1px solid #aaa;
min-height:40px;
}
li.game-bottom{
border-top:1px solid #aaa;
}
</style>
</br>
<h5>Championship Match</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
1st
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
<h5>3rd/4th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.winnerName %> <span></span></li>
3rd
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>

View File

@@ -1,123 +0,0 @@
<style>
/*
* Flex Layout Specifics
*/
main{
display:flex;
flex-direction:row;
}
.round{
display:flex;
flex-direction:column;
justify-content:center;
width:200px;
list-style:none;
padding:0;
}
.round .spacer{ flex-grow:1; }
.round .spacer:first-child,
.round .spacer:last-child{ flex-grow:.5; }
.round .game-spacer{
flex-grow:1;
}
/*
* General Styles
*/
body{
font-family:sans-serif;
font-size:small;
padding:10px;
line-height:1.4em;
}
li.game{
padding-left:20px;
}
li.game.winner{
font-weight:bold;
}
li.game span{
float:right;
margin-right:5px;
}
li.game-top{ border-bottom:1px solid #aaa; }
li.game-spacer{
border-right:1px solid #aaa;
min-height:40px;
}
li.game-bottom{
border-top:1px solid #aaa;
}
</style>
</br>
<h5>Championship Bracket After Pool</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
<% end %>
</ul>
<ul class="round round-2">
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
1st
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>
</br>
<h5>3rd/4th</h5>
<main id="bracket">
<ul class="round round-1">
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
<li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.bout_number %> <%= match.bracketScore %>&nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li>
</ul>
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top "> <%= match.winnerName %><span></span></li>
3rd
<li class="spacer">&nbsp;</li>
</ul>
<% end %>
</main>

View File

@@ -1,51 +0,0 @@
<style>
.pagebreak { page-break-after: always; width:100%;}
#html, #body, #wrapper { width:100%; }
</style>
<script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script>
<script>
function exportDataToRtf() {
var blob = new Blob([document.getElementById("exportable").innerHTML], {
type: "application/octet-stream"
});
saveAs(blob, "brackets.rtf");
}
</script>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/weights" %>
<br>
<br>
<button type="submit" class="btn btn-primary" onclick="exportDataToRtf()">Export to file for printing</button>
<!--[if lte IE 9]>
<div>Excel export does not work on IE versions lower than 10. Please use chrome or update IE.</div>
<!--<![endif]-->
<br>
<br>
<div id="exportable">
<% @tournament.weights.sort_by{|w| w.max}.each do |w| %>
<div class="pagebreak">
<% @weight = w %>
<% @matches = @tournament.matches.select{|m| m.weight_id == @weight.id} %>
<% @wrestlers = Wrestler.where(weight_id: @weight.id) %>
<% @pools = w.poolRounds(@matches) %>
<h5><%= @weight.max %> lbs Bracket</h5>
<%= render 'pool' %>
</div>
<div class="pagebreak">
<% if w.pool_bracket_type == "twoPoolsToFinal" %>
<%= render 'twoPoolFinalBracket' %>
<% end %>
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
<%= render 'twoPoolSemiBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToQuarter" %>
<%= render 'fourPoolQuarterBracket' %>
<% end %>
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %>
<% end %>
</div>
<% end %>
</div>

View File

@@ -1,23 +0,0 @@
</br>
</br>
</br>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<h1><%= @weight.max %> lbs Bracket</h1>
<%= render 'pool' %>
<% if @bracketType == "twoPoolsToFinal" %>
<%= render 'twoPoolFinalBracket' %>
<% end %>
<% if @bracketType == "twoPoolsToSemi" %>
<%= render 'twoPoolSemiBracket' %>
<% end %>
<% if @bracketType == "fourPoolsToQuarter" %>
<%= render 'fourPoolQuarterBracket' %>
<% end %>
<% if @bracketType == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %>
<% end %>

View File

@@ -1,105 +0,0 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<h3>Round 1</h3>
<% @matches.each do |m| %>
<% if m.round == 1 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 2</h3>
<% @matches.each do |m| %>
<% if m.round == 2 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 3</h3>
<% @matches.each do |m| %>
<% if m.round == 3 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 4</h3>
<% @matches.each do |m| %>
<% if m.round == 4 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 5</h3>
<% @matches.each do |m| %>
<% if m.round == 5 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 6</h3>
<% @matches.each do |m| %>
<% if m.round == 6 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>

View File

@@ -1,38 +0,0 @@
<h1>Pick A Tournament</h1>
<script>
$(document).ready(function() {
$('#tournamentList').dataTable();
pagingType: "bootstrap";
} );
</script>
<% if user_signed_in? %>
<%= link_to 'New Tournament', new_tournament_path, :class=>"btn btn-success" %>
<% end %>
</br>
</br>
<table class="display compact cell-border" id="tournamentList">
<thead>
<tr>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
<td><%= tournament.name %></td>
<td><%= link_to 'Show', tournament, :class=>"btn btn-default" %>
<% if tournament_permissions(tournament) %>
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary" %>
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br>

View File

@@ -1,63 +0,0 @@
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<% if params[:tournament] %>
<% @weights.each do |weight| %>
<%= link_to "#{weight.max}" , "/static_pages/weigh_in?weight=#{weight.id}" %>
<br>
<% end %>
<br>
<% if tournament_permissions(@tournament) %>
<%= form_for(@tournament) do |f| %>
<div class="field">
<%= f.label :weigh_in_ref %><br>
<%= f.text_field :weigh_in_ref %>
</div>
<br>
<%= f.submit 'Submit', :class=>"btn btn-success" %>
<% end %>
<% end %>
<% end %>
<% if @weight %>
<%= link_to "Back to weigh in weights","/static_pages/weigh_in?tournament=#{@tournament_id}", :class=>"btn btn-default" %>
<br><br>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>School</th>
<th>Seed</th>
<th>Weight Class</th>
<th>Offical Weight</th>
</tr>
</thead>
<tbody>
<%= form_tag @wrestlers_update_path do %>
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
<% if wrestler.weight_id == @weight.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= School.find(wrestler.school_id).name %></td>
<td><%= wrestler.original_seed %></td>
<td><%= wrestler.weight.max %></td>
<td>
<% if user_signed_in? %>
<%= fields_for "wrestler[]", wrestler do |w| %>
<%= w.number_field :offical_weight, :step => 'any' %>
<% end %>
<% else %>
<%= wrestler.offical_weight %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%= hidden_field_tag :tournament, @tournament_id %>
<% if tournament_permissions(@tournament) %>
<%= submit_tag "Save", :class=>"btn btn-success"%>
<% end %>
<% end %>
<% end %>