Make (part of) the html valid again

simple_format always wraps its content so the better idea I have got was to use a span to avoid p in p.
This commit is contained in:
simon lehericey 2019-11-06 16:30:20 +01:00
parent 8efac29eba
commit 16814af474
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,6 @@
module StringToHtmlHelper
def string_to_html(str)
html_formatted = simple_format(str)
def string_to_html(str, wrapper_tag = 'p')
html_formatted = simple_format(str, {}, { wrapper_tag: wrapper_tag })
with_links = html_formatted.gsub(URI.regexp, '<a target="_blank" rel="noopener" href="\0">\0</a>')
sanitize(with_links, attributes: ['target', 'rel', 'href'])
end

View file

@ -10,7 +10,7 @@
%br
= service.organisme
%br
= string_to_html(service.adresse)
= string_to_html(service.adresse, wrapper_tag = 'span')
%li.footer-column
%h3.footer-header Poser une question sur votre dossier :
@ -28,7 +28,7 @@
%p
- horaires = "Horaires : #{formatted_horaires(service.horaires)}"
= simple_format(horaires)
= simple_format(horaires, {}, wrapper_tag: 'span')
- politiques = politiques_conservation_de_donnees(procedure)