1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-08 07:22:38 +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")