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:
commit
7205d94a08
5 changed files with 56 additions and 12 deletions
|
@ -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"
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -23,7 +23,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
# We’re testing the (private) method `NotificationMailer#send_notification`.
|
||||
#
|
||||
# The standard trick to test a private method would be to `send(:send_notification)`, but doesn’t 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"
|
||||
|
|
33
spec/mailers/previews/invite_mailer_preview.rb
Normal file
33
spec/mailers/previews/invite_mailer_preview.rb
Normal 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
|
Loading…
Reference in a new issue