2018-11-20 11:57:51 +01:00
|
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
|
2018-05-24 15:55:47 +02:00
|
|
|
|
class DossierMailer < ApplicationMailer
|
|
|
|
|
layout 'mailers/layout'
|
|
|
|
|
|
2018-11-20 11:50:25 +01:00
|
|
|
|
def notify_new_draft(dossier)
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
subject = "Retrouvez votre brouillon pour la démarche \"#{dossier.procedure.libelle}\""
|
|
|
|
|
|
|
|
|
|
mail(to: dossier.user.email, subject: subject)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_new_answer(dossier)
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
subject = "Nouveau message pour votre dossier nº #{dossier.id}"
|
|
|
|
|
|
2018-11-20 12:07:39 +01:00
|
|
|
|
mail(to: dossier.user.email, subject: subject) do |format|
|
|
|
|
|
format.html { render layout: 'mailers/notification' }
|
|
|
|
|
end
|
2018-11-20 11:50:25 +01:00
|
|
|
|
end
|
|
|
|
|
|
2018-05-30 11:36:48 +02:00
|
|
|
|
def notify_deletion_to_user(deleted_dossier, to_email)
|
|
|
|
|
@deleted_dossier = deleted_dossier
|
2018-05-31 15:26:02 +02:00
|
|
|
|
subject = "Votre dossier n° #{@deleted_dossier.dossier_id} a bien été supprimé"
|
2018-05-31 23:58:10 +02:00
|
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
|
mail(to: to_email, subject: subject)
|
2018-05-30 11:36:48 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def notify_deletion_to_administration(deleted_dossier, to_email)
|
|
|
|
|
@deleted_dossier = deleted_dossier
|
2018-05-31 15:26:02 +02:00
|
|
|
|
subject = "Le dossier n° #{@deleted_dossier.dossier_id} a été supprimé à la demande de l'usager"
|
2018-05-31 23:58:10 +02:00
|
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
|
mail(to: to_email, subject: subject)
|
2018-05-24 15:55:47 +02:00
|
|
|
|
end
|
2018-06-13 17:32:50 +02:00
|
|
|
|
|
|
|
|
|
def notify_unhide_to_user(dossier)
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
subject = "Votre dossier n° #{@dossier.id} n'a pas pu être supprimé"
|
|
|
|
|
|
|
|
|
|
mail(to: dossier.user.email, subject: subject)
|
|
|
|
|
end
|
2018-10-10 17:19:59 +02:00
|
|
|
|
|
|
|
|
|
def notify_undelete_to_user(dossier)
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
@dossier_kind = dossier.brouillon? ? 'brouillon' : 'dossier'
|
|
|
|
|
@subject = "Votre #{@dossier_kind} n° #{@dossier.id} est à nouveau accessible"
|
|
|
|
|
|
|
|
|
|
mail(to: dossier.user.email, subject: @subject)
|
|
|
|
|
end
|
2018-10-11 19:27:58 +02:00
|
|
|
|
|
|
|
|
|
def notify_unmigrated_to_user(dossier, new_procedure)
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
@dossier_kind = dossier.brouillon? ? 'brouillon' : 'dossier'
|
|
|
|
|
@subject = "Changement de procédure pour votre #{@dossier_kind} n° #{@dossier.id}"
|
|
|
|
|
@new_procedure = new_procedure
|
|
|
|
|
|
|
|
|
|
mail(to: dossier.user.email, subject: @subject)
|
|
|
|
|
end
|
2018-05-24 15:55:47 +02:00
|
|
|
|
end
|