Skip to content

Commit

Permalink
Merge pull request #10502 from demarches-simplifiees/etq-usager-bouto…
Browse files Browse the repository at this point in the history
…n-jdma

ETQ usager : j'accède au bouton JDMA depuis la page Merci et depuis le mail de dépôt de dossier
  • Loading branch information
Benoit-MINT authored Jun 14, 2024
2 parents 321409e + ee35dba commit 06b8194
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
7 changes: 0 additions & 7 deletions app/assets/stylesheets/merci.scss

This file was deleted.

7 changes: 7 additions & 0 deletions app/mailers/notification_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class NotificationMailer < ApplicationMailer
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_jdma, only: :send_notification

helper ServiceHelper
helper MailerHelper
Expand Down Expand Up @@ -88,6 +89,12 @@ def set_services_publics_plus
@services_publics_plus_url = ENV['SERVICES_PUBLICS_PLUS_URL'].presence
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
@dossier = params[:dossier]
configure_defaults_for_user(@dossier.user)
Expand Down
4 changes: 4 additions & 0 deletions app/models/procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,10 @@ def reset_closing_params
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 validates_associated_draft_revision_with_context
Expand Down
10 changes: 10 additions & 0 deletions app/views/layouts/mailers/_jdma.html.haml
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions app/views/notification_mailer/send_notification.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
- if @services_publics_plus_url.present?
= render 'layouts/mailers/services_publics_plus'

- if @jdma_html.present?
= render 'layouts/mailers/jdma'

- content_for :footer do
= render 'layouts/mailers/service_footer', service: @service, dossier: @dossier
8 changes: 6 additions & 2 deletions app/views/users/dossiers/_merci.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@
%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'

.monavis
!= procedure.monavis_embed
- if procedure.monavis_embed
.monavis
%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")
12 changes: 6 additions & 6 deletions config/brakeman.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
{
"warning_type": "Cross-Site Scripting",
"warning_code": 2,
"fingerprint": "1b805585567775589825c0eda58cb84c074fc760d0a7afb101c023a51427f2b5",
"fingerprint": "26f504696b074d18ef3f5568dc8f6a46d1283a67fe37822498fa25d0409664ab",
"check_name": "CrossSiteScripting",
"message": "Unescaped model attribute",
"file": "app/views/users/dossiers/_merci.html.haml",
"line": 26,
"line": 30,
"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": [
{
"type": "controller",
"class": "Users::DossiersController",
"method": "merci",
"line": 309,
"line": 320,
"file": "app/controllers/users/dossiers_controller.rb",
"rendered": {
"name": "users/dossiers/merci",
Expand Down Expand Up @@ -74,7 +74,7 @@
"check_name": "CrossSiteScripting",
"message": "Unescaped parameter value",
"file": "app/views/faq/show.html.haml",
"line": 12,
"line": 13,
"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)",
"render_path": [
Expand Down Expand Up @@ -203,6 +203,6 @@
"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"
}
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ en:
download_dossier: Download your file
acces_dossier: Access your 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:
header:
summary: "Summary"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ fr:
download_dossier: Télécharger mon dossier
acces_dossier: Accéder à votre 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:
header:
summary: "Résumé"
Expand Down

0 comments on commit 06b8194

Please sign in to comment.