diff --git a/app/views/administration_mailer/dossier_expiration_summary.html.haml b/app/views/administration_mailer/dossier_expiration_summary.html.haml index dc9488ca3..6a15b618c 100644 --- a/app/views/administration_mailer/dossier_expiration_summary.html.haml +++ b/app/views/administration_mailer/dossier_expiration_summary.html.haml @@ -1,7 +1,7 @@ - content_for(:title, 'Expiration du délai de conservation des dossiers') - if @expired_dossiers.present? - %h1= t('mail.administration.dossier_expiration_summary.expired_dossiers', count: @expired_dossiers.count) + %h2= t('mail.administration.dossier_expiration_summary.expired_dossiers', count: @expired_dossiers.count) - @expired_dossiers.group_by(&:procedure).each do |procedure, dossiers| %dl %dt @@ -10,7 +10,7 @@ = dossiers.map { |d| link_to(d.id, manager_dossier_url(d)) }.join(', ').html_safe - if @expiring_dossiers.present? - %h1= t('mail.administration.dossier_expiration_summary.expiring_dossiers', count: @expiring_dossiers.count) + %h2= t('mail.administration.dossier_expiration_summary.expiring_dossiers', count: @expiring_dossiers.count) - @expiring_dossiers.group_by(&:procedure).each do |procedure, dossiers| %dl %dt diff --git a/app/views/avis_mailer/avis_invitation.html.haml b/app/views/avis_mailer/avis_invitation.html.haml index bf39822b7..860e0d256 100644 --- a/app/views/avis_mailer/avis_invitation.html.haml +++ b/app/views/avis_mailer/avis_invitation.html.haml @@ -1,5 +1,4 @@ -- content_for(:title, 'Vous avez été invité à donner votre avis') - +- content_for(:title, 'Invitation à donner votre avis') - avis_link = @avis.gestionnaire.present? ? gestionnaire_avis_url(@avis) : sign_up_gestionnaire_avis_url(@avis.id, @avis.email) - content_for(:footer) do @@ -21,7 +20,7 @@ %p = "#{@avis.claimant.email} vous a écrit :" %br -%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 16px;" } +%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" } = @avis.introduction - if @avis.gestionnaire.present? diff --git a/app/views/gestionnaire_mailer/last_week_overview.html.haml b/app/views/gestionnaire_mailer/last_week_overview.html.haml index 6486b6807..43b2950ae 100644 --- a/app/views/gestionnaire_mailer/last_week_overview.html.haml +++ b/app/views/gestionnaire_mailer/last_week_overview.html.haml @@ -1,8 +1,14 @@ - content_for(:title, @subject) +%p + Bonjour, + +%p + Voici le résumé de votre activité hebdomadaire : + - @overview[:procedure_overviews].each_with_index do |procedure_overview, index| - %h2{ style: 'font-size: 20px; font-weight: 300; margin: 25px 0 5px;' } + %h2{ style: 'font-size: 16px; font-weight: 300; margin: 25px 0 5px;' } #{procedure_overview.procedure.libelle} = link_to 'voir', gestionnaire_procedure_url(procedure_overview.procedure), style: 'color: #0069CC; font-size: 14px;' %table{ cellpadding: '0', cellspacing: '0', style: 'width: 100%; padding-bottom: 20px;' } diff --git a/app/views/invite_mailer/invite_guest.html.haml b/app/views/invite_mailer/invite_guest.html.haml index 27fe008dd..2b30029d2 100644 --- a/app/views/invite_mailer/invite_guest.html.haml +++ b/app/views/invite_mailer/invite_guest.html.haml @@ -4,7 +4,9 @@ %p L'utilisateur = @invite.email_sender - souhaite que vous participiez à l'élaboration d'un dossier sur demarches-simplifiees.fr. + souhaite que vous participiez à l'élaboration d'un dossier pour la démarche + %strong= @invite.dossier.procedure.libelle + sur demarches-simplifiees.fr. %p Cette plateforme permet à ses utilisateurs d'établir des dossiers 100 % en ligne et de dialoguer avec plusieurs interlocuteurs privilégiés avant d'instruire un dépot. diff --git a/spec/mailers/previews/administrateur_mailer_preview.rb b/spec/mailers/previews/administrateur_mailer_preview.rb index 67e6a54b9..afa8762a0 100644 --- a/spec/mailers/previews/administrateur_mailer_preview.rb +++ b/spec/mailers/previews/administrateur_mailer_preview.rb @@ -1,5 +1,7 @@ class AdministrateurMailerPreview < ActionMailer::Preview def activate_before_expiration - AdministrateurMailer.activate_before_expiration(Administrateur.inactive.where.not(reset_password_token: nil).last) + administrateur = Administrateur.new(reset_password_sent_at: Time.now.utc) + + AdministrateurMailer.activate_before_expiration(administrateur, "a4d4e4f4b4d445") end end diff --git a/spec/mailers/previews/administration_mailer_preview.rb b/spec/mailers/previews/administration_mailer_preview.rb index 7e5633c31..0aaa8a069 100644 --- a/spec/mailers/previews/administration_mailer_preview.rb +++ b/spec/mailers/previews/administration_mailer_preview.rb @@ -1,17 +1,42 @@ class AdministrationMailerPreview < ActionMailer::Preview def dubious_procedures procedures_and_champs = [ - [Procedure.first, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'religion')]], - [Procedure.last, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'numéro de carte bleu')]] + [procedure_1, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'religion')]], + [procedure_2, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'numéro de carte bleu')]] ] AdministrationMailer.dubious_procedures(procedures_and_champs) end def invite_admin - AdministrationMailer.invite_admin(Administrateur.last, "12345678", 0) + AdministrationMailer.invite_admin(administrateur, "12345678", 0) end def refuse_admin AdministrationMailer.refuse_admin('bad_admin@pipo.com') end + + def new_admin + administration = Administration.new(email: 'superadmin@demarches-simplifiees.fr') + AdministrationMailer.new_admin_email(administrateur, administration) + end + + def dossier_expiration_summary + expiring_dossiers = [Dossier.new(id: 100, procedure: procedure_1)] + expired_dossiers = [Dossier.new(id: 100, procedure: procedure_2)] + AdministrationMailer.dossier_expiration_summary(expiring_dossiers, expired_dossiers) + end + + private + + def procedure_1 + Procedure.new(id: 10, libelle: "Démarche des marches", administrateur: administrateur) + end + + def procedure_2 + Procedure.new(id: 20, libelle: "Démarche pieds", administrateur: administrateur) + end + + def administrateur + Administrateur.new(id: 111, email: "chef.de.service@administration.gouv.fr") + end end diff --git a/spec/mailers/previews/avis_mailer_preview.rb b/spec/mailers/previews/avis_mailer_preview.rb index be78eae74..72d715f93 100644 --- a/spec/mailers/previews/avis_mailer_preview.rb +++ b/spec/mailers/previews/avis_mailer_preview.rb @@ -1,6 +1,11 @@ # Preview all emails at http://localhost:3000/rails/mailers/avis_mailer class AvisMailerPreview < ActionMailer::Preview def avis_invitation - AvisMailer.avis_invitation(Avis.last) + gestionaire = Gestionnaire.new(id: 1, email: 'jeanmichel.de-chauvigny@exemple.fr') + avis = Avis.new(id: 1, email: 'test@exemple.fr', claimant: gestionaire) + avis.dossier = Dossier.new(id: 1) + avis.dossier.procedure = Procedure.new(libelle: 'Démarche pour faire des marches') + avis.introduction = 'Il faudrait vérifier le certificat de conformité.' + AvisMailer.avis_invitation(avis) end end diff --git a/spec/mailers/previews/devise_user_mailer_preview.rb b/spec/mailers/previews/devise_user_mailer_preview.rb index fdaab876b..6aea003ec 100644 --- a/spec/mailers/previews/devise_user_mailer_preview.rb +++ b/spec/mailers/previews/devise_user_mailer_preview.rb @@ -1,9 +1,15 @@ class DeviseUserMailerPreview < ActionMailer::Preview def confirmation_instructions - DeviseUserMailer.confirmation_instructions(User.first, "faketoken", {}) + DeviseUserMailer.confirmation_instructions(user, "faketoken", {}) end def reset_password_instructions - DeviseUserMailer.reset_password_instructions(User.first, "faketoken", {}) + DeviseUserMailer.reset_password_instructions(user, "faketoken", {}) + end + + private + + def user + User.new(id: 10, email: "usager@example.com") end end diff --git a/spec/mailers/previews/dossier_mailer_preview.rb b/spec/mailers/previews/dossier_mailer_preview.rb index de22920f6..b914b27c5 100644 --- a/spec/mailers/previews/dossier_mailer_preview.rb +++ b/spec/mailers/previews/dossier_mailer_preview.rb @@ -1,18 +1,32 @@ # Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer class DossierMailerPreview < ActionMailer::Preview def notify_new_draft - DossierMailer.notify_new_draft(Dossier.last) + DossierMailer.notify_new_draft(dossier) end def notify_new_answer - DossierMailer.notify_new_answer(Dossier.last) + DossierMailer.notify_new_answer(dossier) end def notify_deletion_to_user - DossierMailer.notify_deletion_to_user(DeletedDossier.last, "user@ds.fr") + DossierMailer.notify_deletion_to_user(deleted_dossier, "user@ds.fr") end def notify_deletion_to_administration - DossierMailer.notify_deletion_to_administration(DeletedDossier.last, "admin@ds.fr") + DossierMailer.notify_deletion_to_administration(deleted_dossier, "admin@ds.fr") + end + + private + + def deleted_dossier + DeletedDossier.new(dossier_id: 1, procedure: procedure) + end + + def dossier + Dossier.new(id: 1, procedure: procedure, user: User.new(email: "usager@example.com")) + end + + def procedure + Procedure.new(libelle: 'Démarche pour des marches') end end diff --git a/spec/mailers/previews/gestionnaire_mailer_preview.rb b/spec/mailers/previews/gestionnaire_mailer_preview.rb index d7707bd22..ddafd66b4 100644 --- a/spec/mailers/previews/gestionnaire_mailer_preview.rb +++ b/spec/mailers/previews/gestionnaire_mailer_preview.rb @@ -1,14 +1,35 @@ class GestionnaireMailerPreview < ActionMailer::Preview def last_week_overview - gestionnaire = Gestionnaire.first - GestionnaireMailer.last_week_overview(gestionnaire) + GestionnaireMailer.last_week_overview(Gestionnaire.first) end def send_dossier - GestionnaireMailer.send_dossier(Gestionnaire.first, Dossier.first, Gestionnaire.last) + GestionnaireMailer.send_dossier(gestionnaire, Dossier.new(id: 10, procedure: procedure), target_gestionnaire) end def send_login_token - GestionnaireMailer.send_login_token(Gestionnaire.first, "token") + GestionnaireMailer.send_login_token(gestionnaire, "token") + end + + def invite_gestionnaire + GestionnaireMailer.invite_gestionnaire(gestionnaire, 'aedfa0d0') + end + + def user_to_gestionnaire + GestionnaireMailer.user_to_gestionnaire(gestionnaire.email) + end + + private + + def gestionnaire + Gestionnaire.new(id: 10, email: 'instructeur@administration.gouv.fr') + end + + def target_gestionnaire + Gestionnaire.new(id: 12, email: 'collegue@administration.gouv.fr') + end + + def procedure + Procedure.new(id: 15) end end diff --git a/spec/mailers/previews/user_mailer_preview.rb b/spec/mailers/previews/user_mailer_preview.rb index d2dfa3e70..4204d63be 100644 --- a/spec/mailers/previews/user_mailer_preview.rb +++ b/spec/mailers/previews/user_mailer_preview.rb @@ -1,5 +1,11 @@ class UserMailerPreview < ActionMailer::Preview def new_account_warning - UserMailer.new_account_warning(User.first) + UserMailer.new_account_warning(user) + end + + private + + def user + User.new(id: 10, email: 'test@exemple.fr') end end