[Fix #3064] Add logo and cancel link on preview

This commit is contained in:
Mathieu Magnin 2019-03-14 16:15:55 +01:00
parent 7e551a9d8d
commit 60d66f0422
3 changed files with 12 additions and 6 deletions

View file

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

View file

@ -39,8 +39,9 @@ class NotificationMailer < ApplicationMailer
@dossier = dossier
if dossier.procedure.logo?
@logo_filename = dossier.procedure.logo.filename
attachments.inline[@logo_filename] = dossier.procedure.logo.read
logo_filename = dossier.procedure.logo.filename
attachments.inline[logo_filename] = dossier.procedure.logo.read
@logo_url = attachments[logo_filename].url
end
mail(subject: subject, to: email) do |format|

View file

@ -1,14 +1,18 @@
- if @logo_filename.present?
- if @logo_url.present?
- content_for :procedure_logo do
%table{ width: "100%", border: "0", cellspacing: "0", cellpadding: "0" }
%tr
%td{ align: "center" }
= image_tag attachments[@logo_filename].url, style: "height: 150px;"
= image_tag @logo_url, style: "height: 150px;"
- content_for :footer do
- if @dossier.present?
- messagerie_url = messagerie_dossier_url(@dossier)
- else
- messagerie_url = "#"
%strong
Merci de ne pas répondre à cet email. Pour vous adresser à votre administration, passez directement par votre
= succeed '.' do
= link_to 'messagerie', messagerie_dossier_url(@dossier), target: '_blank', rel: 'noopener'
= link_to 'messagerie', messagerie_url, target: '_blank', rel: 'noopener'
= render template: 'layouts/mailers/notifications_layout'