feat(flash messages): add a helper method to keep link when sanitizing
This commit is contained in:
parent
28c6fd8cfc
commit
127f86e8ae
2 changed files with 8 additions and 2 deletions
6
app/helpers/sanitize_with_link_helper.rb
Normal file
6
app/helpers/sanitize_with_link_helper.rb
Normal 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
|
|
@ -7,8 +7,8 @@
|
||||||
- if value.class == Array
|
- if value.class == Array
|
||||||
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
|
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
|
||||||
- value.each do |message|
|
- value.each do |message|
|
||||||
= sanitize(message)
|
= sanitize_with_link(message)
|
||||||
%br
|
%br
|
||||||
- else
|
- else
|
||||||
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
|
.alert{ class: flash_class(key, sticky: sticky, fixed: fixed), role: flash_role(key) }
|
||||||
= sanitize(value)
|
= sanitize_with_link(value)
|
||||||
|
|
Loading…
Reference in a new issue