2018-05-29 12:16:22 +02:00
|
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
|
|
|
|
|
class DossierMailerPreview < ActionMailer::Preview
|
2018-11-20 11:50:25 +01:00
|
|
|
|
def notify_new_draft
|
2019-07-17 14:40:17 +02:00
|
|
|
|
DossierMailer.notify_new_draft(draft)
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_new_answer
|
2018-12-20 16:49:56 +01:00
|
|
|
|
DossierMailer.notify_new_answer(dossier)
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
2018-05-30 11:36:48 +02:00
|
|
|
|
def notify_deletion_to_user
|
2018-12-20 16:49:56 +01:00
|
|
|
|
DossierMailer.notify_deletion_to_user(deleted_dossier, "user@ds.fr")
|
2018-05-30 11:36:48 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_deletion_to_administration
|
2018-12-20 16:49:56 +01:00
|
|
|
|
DossierMailer.notify_deletion_to_administration(deleted_dossier, "admin@ds.fr")
|
|
|
|
|
end
|
|
|
|
|
|
2019-03-25 16:04:33 +01:00
|
|
|
|
def notify_revert_to_instruction
|
|
|
|
|
DossierMailer.notify_revert_to_instruction(dossier)
|
|
|
|
|
end
|
|
|
|
|
|
2019-12-03 15:51:16 +01:00
|
|
|
|
def notify_brouillon_near_deletion
|
|
|
|
|
DossierMailer.notify_brouillon_near_deletion(User.new(email: "usager@example.com"), [dossier])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_brouillons_near_deletion
|
|
|
|
|
DossierMailer.notify_brouillon_near_deletion(User.new(email: "usager@example.com"), [dossier, dossier])
|
|
|
|
|
end
|
2019-11-28 18:03:23 +01:00
|
|
|
|
|
|
|
|
|
def notify_brouillon_deletion
|
|
|
|
|
DossierMailer.notify_brouillon_deletion(User.new(email: "usager@example.com"), [dossier.hash_for_deletion_mail])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_brouillons_deletion
|
|
|
|
|
dossier_hashes = [dossier, dossier].map(&:hash_for_deletion_mail)
|
|
|
|
|
DossierMailer.notify_brouillon_deletion(User.new(email: "usager@example.com"), dossier_hashes)
|
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def deleted_dossier
|
|
|
|
|
DeletedDossier.new(dossier_id: 1, procedure: procedure)
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-17 14:40:17 +02:00
|
|
|
|
def draft
|
|
|
|
|
Dossier.new(id: 47882, procedure: procedure, user: User.new(email: "usager@example.com"))
|
|
|
|
|
end
|
|
|
|
|
|
2018-12-20 16:49:56 +01:00
|
|
|
|
def dossier
|
2019-07-17 14:40:17 +02:00
|
|
|
|
Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: User.new(email: "usager@example.com"))
|
2018-12-20 16:49:56 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def procedure
|
2019-07-17 14:40:17 +02:00
|
|
|
|
Procedure.new(libelle: 'Dotation d’Équipement des Territoires Ruraux - Exercice 2019', service: service, logo: Rack::Test::UploadedFile.new("./spec/fixtures/files/logo_test_procedure.png", 'image/png'))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def service
|
|
|
|
|
Service.new(
|
|
|
|
|
nom: 'Direction du Territoire des Vosges',
|
|
|
|
|
email: 'prms@ddt.vosges.gouv.fr',
|
|
|
|
|
telephone: '01 34 22 33 85',
|
|
|
|
|
horaires: 'Du lundi au vendredi, de 9 h à 18 h'
|
|
|
|
|
)
|
2018-05-29 12:16:22 +02:00
|
|
|
|
end
|
|
|
|
|
end
|