ajout d'un helper pour la source

This commit is contained in:
Benoit Queyron 2024-06-10 11:09:55 +02:00
parent d7a19bd421
commit 0983f35dfd
4 changed files with 7 additions and 3 deletions

View file

@ -92,7 +92,7 @@ class NotificationMailer < ApplicationMailer
def set_jdma
return unless params[:state] == Dossier.states.fetch(:en_construction)
@jdma_html = @dossier.procedure.monavis_embed.presence
@jdma_html = @dossier.procedure.monavis_embed_html_source("email").presence
end
def set_dossier

View file

@ -1008,6 +1008,10 @@ class Procedure < ApplicationRecord
update!(closing_reason: nil, closing_details: nil, replaced_by_procedure_id: nil, closing_notification_brouillon: false, closing_notification_en_cours: false)
end
def monavis_embed_html_source(source)
monavis_embed.gsub('nd_source=button', "nd_source=#{source}").gsub('<a ', '<a target="_blank" rel="noopener noreferrer" ')
end
private
def validate_auto_archive_on_in_the_future

View file

@ -5,6 +5,6 @@
%strong Aidez-nous à améliorer ce service !
%br
Donnez-nous votre avis, cela ne prend que 2 minutes.
!= @jdma_html.gsub('nd_source=button', 'nd_source=email').gsub('<a ', '<a target="_blank" rel="noopener noreferrer" ')
!= @jdma_html
= vertical_margin(20)

View file

@ -27,4 +27,4 @@
%p.fr-mt-5w.fr-mb-1w
%strong= t('views.users.dossiers.merci.jdma_l1')
%p= t('views.users.dossiers.merci.jdma_l2')
!= procedure.monavis_embed.gsub('nd_source=button', 'nd_source=site').gsub('<a ', '<a target="_blank" rel="noopener noreferrer" ')
!= procedure.monavis_embed_html_source("site")