1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Hide ads on schools#show, wrestlers#new, wrestlers#edit, and mats#show

This commit is contained in:
2026-02-11 07:55:49 -05:00
parent fcc8a9b9a9
commit d57aaac09d
4 changed files with 74 additions and 8 deletions

View File

@@ -1,9 +1,15 @@
module ApplicationHelper
def hide_ads?
return false unless controller_name == "schools"
return false unless %w[show edit new].include?(action_name)
user_signed_in? || school_permission_key_present?
case controller_name
when "schools"
action_name == "show" && (user_signed_in? || school_permission_key_present?)
when "wrestlers"
%w[new edit].include?(action_name) && (user_signed_in? || school_permission_key_present?)
when "mats"
action_name == "show" && user_signed_in?
else
false
end
end
def school_permission_key_present?