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

52 lines
1.7 KiB
Plaintext

<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", "/static_pages/weights?tournament=#{@tournament.id}" %>
<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>