Merge pull request #10502 from demarches-simplifiees/etq-usager-bouton-jdma

ETQ usager : j'accède au bouton JDMA depuis la page Merci et depuis le mail de dépôt de dossier
This commit is contained in:
Benoit Queyron 2024-06-14 16:31:12 +00:00 committed by GitHub
commit 06b8194359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 40 additions and 15 deletions

View file

@ -1,7 +0,0 @@
@import "constants";
.merci .monavis {
img {
margin-top: 2 * $default-padding;
}
}

View file

@ -8,6 +8,7 @@
class NotificationMailer < ApplicationMailer class NotificationMailer < ApplicationMailer
before_action :set_dossier, except: [:send_notification_for_tiers, :send_accuse_lecture_notification] before_action :set_dossier, except: [:send_notification_for_tiers, :send_accuse_lecture_notification]
before_action :set_services_publics_plus, only: :send_notification before_action :set_services_publics_plus, only: :send_notification
before_action :set_jdma, only: :send_notification
helper ServiceHelper helper ServiceHelper
helper MailerHelper helper MailerHelper
@ -88,6 +89,12 @@ class NotificationMailer < ApplicationMailer
@services_publics_plus_url = ENV['SERVICES_PUBLICS_PLUS_URL'].presence @services_publics_plus_url = ENV['SERVICES_PUBLICS_PLUS_URL'].presence
end end
def set_jdma
if params[:state] == Dossier.states.fetch(:en_construction) && @dossier.procedure.monavis_embed
@jdma_html = @dossier.procedure.monavis_embed_html_source("email")
end
end
def set_dossier def set_dossier
@dossier = params[:dossier] @dossier = params[:dossier]
configure_defaults_for_user(@dossier.user) configure_defaults_for_user(@dossier.user)

View file

@ -1019,6 +1019,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) update!(closing_reason: nil, closing_details: nil, replaced_by_procedure_id: nil, closing_notification_brouillon: false, closing_notification_en_cours: false)
end 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 private
def validates_associated_draft_revision_with_context def validates_associated_draft_revision_with_context

View file

@ -0,0 +1,10 @@
= vertical_margin(50)
%div{ align: "center" }
%p
%strong Aidez-nous à améliorer ce service !
%br
Donnez-nous votre avis, cela ne prend que 2 minutes.
!= @jdma_html
= vertical_margin(20)

View file

@ -9,5 +9,8 @@
- if @services_publics_plus_url.present? - if @services_publics_plus_url.present?
= render 'layouts/mailers/services_publics_plus' = render 'layouts/mailers/services_publics_plus'
- if @jdma_html.present?
= render 'layouts/mailers/jdma'
- content_for :footer do - content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier = render 'layouts/mailers/service_footer', service: @service, dossier: @dossier

View file

@ -26,5 +26,9 @@
%hr.fr-hr %hr.fr-hr
= link_to t('views.users.dossiers.merci.submit_dossier'), commencer_url(procedure.path), class: 'fr-btn fr-btn--secondary fr-mt-2w' = link_to t('views.users.dossiers.merci.submit_dossier'), commencer_url(procedure.path), class: 'fr-btn fr-btn--secondary fr-mt-2w'
- if procedure.monavis_embed
.monavis .monavis
!= procedure.monavis_embed %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_html_source("site")

View file

@ -3,19 +3,19 @@
{ {
"warning_type": "Cross-Site Scripting", "warning_type": "Cross-Site Scripting",
"warning_code": 2, "warning_code": 2,
"fingerprint": "1b805585567775589825c0eda58cb84c074fc760d0a7afb101c023a51427f2b5", "fingerprint": "26f504696b074d18ef3f5568dc8f6a46d1283a67fe37822498fa25d0409664ab",
"check_name": "CrossSiteScripting", "check_name": "CrossSiteScripting",
"message": "Unescaped model attribute", "message": "Unescaped model attribute",
"file": "app/views/users/dossiers/_merci.html.haml", "file": "app/views/users/dossiers/_merci.html.haml",
"line": 26, "line": 30,
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting", "link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
"code": "current_user.dossiers.includes(:procedure).find(params[:id]).procedure.monavis_embed", "code": "current_user.dossiers.includes(:procedure).find(params[:id]).procedure.monavis_embed_html_source(\"site\")",
"render_path": [ "render_path": [
{ {
"type": "controller", "type": "controller",
"class": "Users::DossiersController", "class": "Users::DossiersController",
"method": "merci", "method": "merci",
"line": 309, "line": 320,
"file": "app/controllers/users/dossiers_controller.rb", "file": "app/controllers/users/dossiers_controller.rb",
"rendered": { "rendered": {
"name": "users/dossiers/merci", "name": "users/dossiers/merci",
@ -74,7 +74,7 @@
"check_name": "CrossSiteScripting", "check_name": "CrossSiteScripting",
"message": "Unescaped parameter value", "message": "Unescaped parameter value",
"file": "app/views/faq/show.html.haml", "file": "app/views/faq/show.html.haml",
"line": 12, "line": 13,
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting", "link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
"code": "Redcarpet::Markdown.new(Redcarpet::TrustedRenderer.new(view_context), :autolink => true).render(loader_service.find(\"#{params[:category]}/#{params[:slug]}\").content)", "code": "Redcarpet::Markdown.new(Redcarpet::TrustedRenderer.new(view_context), :autolink => true).render(loader_service.find(\"#{params[:category]}/#{params[:slug]}\").content)",
"render_path": [ "render_path": [
@ -203,6 +203,6 @@
"note": "Current is not a model" "note": "Current is not a model"
} }
], ],
"updated": "2024-04-23 18:27:12 +0200", "updated": "2024-06-10 11:21:19 +0200",
"brakeman_version": "6.1.2" "brakeman_version": "6.1.2"
} }

View file

@ -447,6 +447,8 @@ en:
download_dossier: Download your file download_dossier: Download your file
acces_dossier: Access your file acces_dossier: Access your file
submit_dossier: Submit an other file submit_dossier: Submit an other file
jdma_l1: Help us improve this service!
jdma_l2: Give us your feedback, it only takes 2 minutes.
show: show:
header: header:
summary: "Summary" summary: "Summary"

View file

@ -450,6 +450,8 @@ fr:
download_dossier: Télécharger mon dossier download_dossier: Télécharger mon dossier
acces_dossier: Accéder à votre dossier acces_dossier: Accéder à votre dossier
submit_dossier: Déposer un autre dossier submit_dossier: Déposer un autre dossier
jdma_l1: Aidez-nous à améliorer ce service !
jdma_l2: Donnez-nous votre avis, cela ne prend que 2 minutes.
show: show:
header: header:
summary: "Résumé" summary: "Résumé"