1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00

Create bout sheets and make all printable pages go to a new window

This commit is contained in:
2019-01-08 16:03:33 +00:00
parent 2a506e072d
commit 07b51103bf
7 changed files with 134 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
class TournamentsController < ApplicationController
before_action :set_tournament, only: [:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
before_action :set_tournament, only: [:bout_sheets,:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
before_action :check_access_manage, only: [:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches]
before_action :check_access_destroy, only: [:destroy,:delegate,:remove_delegate]
before_action :check_tournament_errors, only: [:generate_matches]
@@ -186,6 +186,17 @@ class TournamentsController < ApplicationController
@mats = @tournament.mats.includes(:matches)
end
def bout_sheets
if params[:round]
round = params[:round]
if round != "All"
@matches = @tournament.matches.where("round = ?",round).sort_by{|match| match.bout_number}
else
@matches = @tournament.matches.sort_by{|match| match.bout_number}
end
end
end
def index
if params[:search]
@tournaments = Tournament.search(params[:search]).order("created_at DESC")

View File

@@ -20,7 +20,13 @@
<br><strong>Pages</strong><br>
<br><%= link_to "Weigh In Page" , "/tournaments/#{@tournament.id}/weigh_in" %>
<br><%= link_to "All Matches" , "/tournaments/#{@tournament.id}/matches" %>
<br><%= link_to "Full Screen Bout Board" , "/tournaments/#{@tournament.id}/up_matches?print=true" %>
<br><%= link_to "Full Screen Bout Board" , "/tournaments/#{@tournament.id}/up_matches?print=true" , target: :_blank %>
<br>Bout Sheets: <ul>
<% 1.upto(@tournament.total_rounds) do |round| %>
<li><%= link_to "Round #{round}" , "/tournaments/#{@tournament.id}/bout_sheets?round=#{round}&print=true" , target: :_blank %></li>
<% end %>
<li><%= link_to "All Rounds" , "/tournaments/#{@tournament.id}/bout_sheets?round=All&print=true" , target: :_blank %></li>
</ul>
<br><%= link_to "Deduct Team Points" , "/tournaments/#{@tournament.id}/teampointadjust" %>
<% if can? :destroy, @tournament %>
<br><%= link_to "Tournament Delegation" , "/tournaments/#{@tournament.id}/delegate" %>

View File

@@ -2,6 +2,7 @@
<html>
<% if params[:print] %>
<head>
<%= csrf_meta_tags %>
<title>WrestlingDev</title>
<%= render 'layouts/cdn' %>
<%= render 'layouts/shim' %>

View File

@@ -0,0 +1,111 @@
<style>
.pagebreak {
page-break-after: always;
margin: 0px;
padding: 0px;
width: 7in; /* width: 7in; */
height: 9.5in; /* or height: 9.5in; */
font-size: 10px;
position: left;
left: 1in;
height: 1in;
}
</style>
<% @matches.each do |match| %>
<% if match.w1 && match.w2 %>
<% w1 = Wrestler.find(match.w1) %>
<% w2 = Wrestler.find(match.w2) %>
<% end %>
<table class='pagebreak table table-striped table-bordered table-condensed'>
<h4><strong>Bout Number: <%= match.bout_number %></strong></h4>
<h4><strong>Weight Class: <%= match.weight.max %></strong></h4>
<h4><strong>Round: <%= match.round %></strong></h4>
<p><strong>Key: </strong>Takedown: T2, Escape: E1, Reversal: R2, Nearfall: N2 or N3, Stalling: S, Caution: C, Penalty Point: P1</p>
<thead>
<tr>
<th>Circle Winner</th>
<th>
<p><%= match.w1_name %></p>
<p><%= if w1 then w1.school.name end %></p>
</th>
<th>
<p><%= match.w2_name %></p>
<p><%= if w2 then w2.school.name end %></p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>red / green (circle one)</td>
<td>red / green (circle one)</td>
</tr>
<tr>
<td>Period 1</td>
<td><br><br><br><br><br><br><br><br><br></td>
<td><br><br><br><br><br><br><br><br><br></td>
</tr>
<tr>
<td>Choice</td>
<td>top / bottom / neutral / defer (circle one)</td>
<td>top / bottom / neutral / defer (circle one)</td>
</tr>
<tr>
<td>Period 2</td>
<td><br><br><br><br><br><br><br><br><br></td>
<td><br><br><br><br><br><br><br><br><br></td>
</tr>
<tr>
<td>Choice</td>
<td>top / bottom / neutral / defer (circle one)</td>
<td>top / bottom / neutral / defer (circle one)</td>
</tr>
<tr>
<td>Period 3</td>
<td><br><br><br><br><br><br><br><br><br></td>
<td><br><br><br><br><br><br><br><br><br></td>
</tr>
<tr>
<td>Overtime 1</td>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td>Choice</td>
<td>top / bottom / neutral / defer (circle one)</td>
<td>top / bottom / neutral / defer (circle one)</td>
</tr>
<tr>
<td>Overtime 2</td>
<td><br><br></td>
<td><br><br></td>
</tr>
<tr>
<td>Choice</td>
<td>top / bottom / neutral / defer (circle one)</td>
<td>top / bottom / neutral / defer (circle one)</td>
</tr>
<tr>
<td>Overtime 3</td>
<td><br><br></td>
<td><br><br></td>
</tr>
<tr>
<td>Choice</td>
<td>top / bottom / neutral / defer (circle one)</td>
<td>top / bottom / neutral / defer (circle one)</td>
</tr>
<tr>
<td>Overtime 4</td>
<td><br><br></td>
<td><br><br></td>
</tr>
<tr>
<td><strong>Final Score</strong> (or pin time, default, disqualified, etc)</td>
<td><br><br></td>
<td><br><br></td>
</tr>
</tbody>
</table>
<% end %>

View File

@@ -6,5 +6,5 @@
<br>
<% end %>
<% if can? :manage, @tournament %>
<%= link_to "All Brackets (Printable)", "/tournaments/#{@tournament.id}/all_brackets?print=true" %>
<%= link_to "All Brackets (Printable)", "/tournaments/#{@tournament.id}/all_brackets?print=true", target: :_blank %>
<% end %>

View File

@@ -18,6 +18,6 @@
<% end %>
<br>
<br>
<%= link_to "Printable Weigh In Sheet" , "/tournaments/#{@tournament.id}/weigh_in_sheet?print=true" %>
<%= link_to "Printable Weigh In Sheet" , "/tournaments/#{@tournament.id}/weigh_in_sheet?print=true", target: :_blank %>

View File

@@ -37,6 +37,7 @@ Wrestling::Application.routes.draw do
get 'tournaments/:id/generate_matches' => 'tournaments#generate_matches'
get 'tournaments/:id/team_scores' => 'tournaments#team_scores'
get 'tournaments/:id/up_matches' => 'tournaments#up_matches', :as => :up_matches
get 'tournaments/:id/bout_sheets' => 'tournaments#bout_sheets'
get 'tournaments/:id/no_matches' => 'tournaments#no_matches'
get 'tournaments/:id/matches' => 'tournaments#matches'
get 'tournaments/:id/delegate' => 'tournaments#delegate', :as => :tournament_delegate