[Fix #3064] Add service footer on notification emails

This commit is contained in:
Mathieu Magnin 2019-03-21 15:39:37 +01:00
parent 60d66f0422
commit 9c6c11027c
3 changed files with 30 additions and 4 deletions

View file

@ -4,9 +4,10 @@ module NewAdministrateur
def preview def preview
@procedure = procedure @procedure = procedure
@dossier = Dossier.new(id: 0)
mail_template = find_mail_template_by_slug(params[:id])
@logo_url = procedure.logo.url @logo_url = procedure.logo.url
@service = procedure.service
mail_template = find_mail_template_by_slug(params[:id])
render(html: sanitize(mail_template.body), layout: 'mailers/notification') render(html: sanitize(mail_template.body), layout: 'mailers/notification')
end end

View file

@ -36,14 +36,15 @@ class NotificationMailer < ApplicationMailer
create_commentaire_for_notification(dossier, subject, body) create_commentaire_for_notification(dossier, subject, body)
@dossier = dossier
if dossier.procedure.logo? if dossier.procedure.logo?
logo_filename = dossier.procedure.logo.filename logo_filename = dossier.procedure.logo.filename
attachments.inline[logo_filename] = dossier.procedure.logo.read attachments.inline[logo_filename] = dossier.procedure.logo.read
@logo_url = attachments[logo_filename].url @logo_url = attachments[logo_filename].url
end end
@dossier = dossier
@service = dossier.procedure.service
mail(subject: subject, to: email) do |format| mail(subject: subject, to: email) do |format|
# rubocop:disable Rails/OutputSafety # rubocop:disable Rails/OutputSafety
format.html { render(html: body.html_safe, layout: 'mailers/notification') } format.html { render(html: body.html_safe, layout: 'mailers/notification') }

View file

@ -15,4 +15,28 @@
= succeed '.' do = succeed '.' do
= link_to 'messagerie', messagerie_url, target: '_blank', rel: 'noopener' = link_to 'messagerie', messagerie_url, target: '_blank', rel: 'noopener'
- if @service.present?
%table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0", style: "cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:11px;line-height:22px;text-align:left;" }
%tr
%td{ width: "50%", valign: "top" }
%p
%strong Cette démarche est gérée par :
%br
= @service.nom
%br
= @service.organisme
%br
= @service.adresse
%td{ width: "50%", valign: "top" }
%p
%strong Poser une question sur votre dossier :
%br
= link_to 'Par la messagerie', messagerie_url, target: '_blank', rel: 'noopener'
%br
Par téléphone :
= link_to @service.telephone, "tel:#{@service.telephone}"
%br
Horaires : #{ formatted_horaires(@service.horaires) }
= render template: 'layouts/mailers/notifications_layout' = render template: 'layouts/mailers/notifications_layout'