Merge pull request #8675 from E-L-T/allow-links-in-flash-messages

fix(flash messages): allow links in flash messages
This commit is contained in:
Eric Leroy-Terquem 2023-02-23 10:02:41 +00:00 committed by GitHub
commit 2f0a46386f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,6 @@
module SanitizeWithLinkHelper
def sanitize_with_link(value)
tags = Rails.configuration.action_view.sanitized_allowed_tags + ['a']
sanitize(value, tags:)
end
end

View file

@ -7,8 +7,8 @@
- if value.class == Array
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
- value.each do |message|
= sanitize(message)
= sanitize_with_link(message)
%br
- else
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
= sanitize(value)
= sanitize_with_link(value)