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:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user