demarches-normaliennes/app/helpers/application_helper.rb
2018-01-18 17:35:19 +01:00

22 lines
454 B
Ruby

module ApplicationHelper
include SanitizeUrl
def sanitize_url(url)
if !url.nil?
super(url, schemes: ['http', 'https'], replace_evil_with: root_url)
end
end
def flash_class(level)
case level
when "notice" then "alert-success"
when "alert" then "alert-danger"
end
end
def current_email
current_user.try(:email) ||
current_gestionnaire.try(:email) ||
current_administrateur.try(:email)
end
end