diff --git a/app/mailers/gestionnaire_mailer.rb b/app/mailers/gestionnaire_mailer.rb index e2ab53919..421df8717 100644 --- a/app/mailers/gestionnaire_mailer.rb +++ b/app/mailers/gestionnaire_mailer.rb @@ -12,17 +12,19 @@ class GestionnaireMailer < ApplicationMailer end def user_to_gestionnaire(email) + @email = email subject = "Vous avez été nommé accompagnateur" - send_mail(email, nil, subject) + mail(to: @email, subject: subject) end def last_week_overview(gestionnaire) + email = gestionnaire.email + @overview = gestionnaire.last_week_overview headers['X-mailjet-campaign'] = 'last_week_overview' - overview = gestionnaire.last_week_overview subject = 'Votre activité hebdomadaire' - send_mail(gestionnaire.email, overview, subject) + mail(to: email, subject: subject) end def send_dossier(sender, dossier, recipient) @@ -32,13 +34,4 @@ class GestionnaireMailer < ApplicationMailer mail(to: recipient.email, subject: subject) end - - private - - def send_mail(email, args, subject) - @args = args - @email = email - - mail(to: email, subject: subject) - end end diff --git a/app/views/gestionnaire_mailer/last_week_overview.html.haml b/app/views/gestionnaire_mailer/last_week_overview.html.haml index 890f0a196..5a0a23550 100644 --- a/app/views/gestionnaire_mailer/last_week_overview.html.haml +++ b/app/views/gestionnaire_mailer/last_week_overview.html.haml @@ -1,6 +1,6 @@ - content_for(:title, 'Votre activité hebdomadaire') -- @args[:procedure_overviews].each_with_index do |procedure_overview, index| +- @overview[:procedure_overviews].each_with_index do |procedure_overview, index| %h2{ style: 'font-size: 20px; font-weight: 300; margin: 25px 0 5px;' } #{procedure_overview.procedure.libelle} @@ -42,5 +42,5 @@ - end.join(', ') = sanitize(old_dossiers_en_instruction, attributes: %w(href style)) - - if index != (@args[:procedure_overviews].count - 1) + - if index != (@overview[:procedure_overviews].count - 1) .spacer{ style: 'border-bottom: 1px solid #CCC; margin: 25px 0 30px;' }