Merge pull request #3173 from maatinito/issue/325_same_design_for_all_mails

[Fix #325] Appliquer le nouveau style graphique des emails à tous les emails
This commit is contained in:
gregoirenovel 2018-12-20 16:25:59 +01:00 committed by GitHub
commit 7205d94a08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 12 deletions

View file

@ -1,5 +1,7 @@
# Preview all emails at http://localhost:3000/rails/mailers/invite_mailer
class InviteMailer < ApplicationMailer
layout 'mailers/layout'
def invite_user(invite)
subject = "Participez à l'élaboration d'un dossier"

View file

@ -116,6 +116,18 @@
</div>
</td>
</tr>
<% if content_for?(:footer) %>
<tr>
<td style="word-wrap:break-word;font-size:0px;padding:0px 25px 0px 25px;padding-top:0px;padding-bottom:0px;" align="left">
<p style="font-size:13px;text-align:left;">
</p>
<p style="cursor:auto;color:#55575d;font-family:Helvetica, Arial, sans-serif;font-size:12px;font-weight:bold;line-height:22px;text-align:left;">
<%= yield(:footer) %>
</p>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View file

@ -1,10 +1,7 @@
= yield
- content_for :footer do
%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'
%footer
%p
%br
%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'
= render template: 'layouts/mailers/layout'

View file

@ -23,7 +23,7 @@ RSpec.describe NotificationMailer, type: :mailer do
# Were testing the (private) method `NotificationMailer#send_notification`.
#
# The standard trick to test a private method would be to `send(:send_notification)`, but doesnt work here,
# because ActionMailer does some magic to expose public instace methods as class methods.
# because ActionMailer does some magic to expose public instance methods as class methods.
# So, we use inheritance instead to make the private method public for testing purposes.
def send_notification(dossier, template)
super
@ -34,7 +34,7 @@ RSpec.describe NotificationMailer, type: :mailer do
it { expect(mail.subject).to eq(email_template.subject_for_dossier) }
it { expect(mail.body).to include(email_template.body_for_dossier) }
it { expect(mail.body).to have_selector('footer') }
it { expect(mail.body).to have_link('messagerie') }
it_behaves_like "create a commentaire not notified"
end
@ -50,7 +50,7 @@ RSpec.describe NotificationMailer, type: :mailer do
it do
expect(mail.subject).to eq(email_template.subject)
expect(mail.body).to include(email_template.body)
expect(mail.body).to have_selector('footer')
expect(mail.body).to have_link('messagerie')
end
it_behaves_like "create a commentaire not notified"

View file

@ -0,0 +1,33 @@
class InviteMailerPreview < ActionMailer::Preview
def invite_user
InviteMailer.invite_user(invite)
end
def invite_guest
InviteMailer.invite_guest(invite)
end
private
def invite
Invite.new(
id: 10,
dossier: dossier,
user: invited_user,
email: invited_user.email,
email_sender: 'sender@gouv.fr'
)
end
def dossier
Dossier.new(procedure: procedure)
end
def procedure
Procedure.new(libelle: 'Permis de construire en zone inondable')
end
def invited_user
User.new(email: 'Invité@gouv.fr')
end
end