1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-30 19:22:21 +00:00

Added is_public to a tournament to hide lineups and brackets until you're ready to make it public

This commit is contained in:
2023-01-01 23:16:12 -05:00
parent d675337d7a
commit c328bbd91c
15 changed files with 547 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
class WeightsController < ApplicationController
before_action :set_weight, only: [:pool_order, :show, :edit, :update, :destroy,:re_gen]
before_action :check_access, only: [:pool_order, :new,:create,:update,:destroy,:edit, :re_gen]
before_action :check_access_manage, only: [:pool_order, :new,:create,:update,:destroy,:edit, :re_gen]
before_action :check_access_read, only: [:show]
# GET /weights/1
@@ -103,7 +104,7 @@ class WeightsController < ApplicationController
def weight_params
params.require(:weight).permit(:max, :tournament_id, :mat_id)
end
def check_access
def check_access_manage
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
elsif params[:weight]
@@ -114,5 +115,16 @@ class WeightsController < ApplicationController
authorize! :manage, @tournament
end
def check_access_read
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
elsif params[:weight]
@tournament = Tournament.find(params[:weight]["tournament_id"])
elsif @weight
@tournament = @weight.tournament
end
authorize! :read, @tournament
end
end