demarches-normaliennes/app/mailers/dossier_mailer.rb

57 lines
1.8 KiB
Ruby
Raw Normal View History

# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
class DossierMailer < ApplicationMailer
layout 'mailers/layout'
def notify_new_draft(dossier)
@dossier = dossier
2019-07-17 13:42:14 +02:00
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} (#{dossier.procedure.libelle})"
mail(to: dossier.user.email, subject: subject) do |format|
format.html { render layout: 'mailers/notification' }
end
end
def notify_deletion_to_user(deleted_dossier, to_email)
@deleted_dossier = deleted_dossier
2019-07-17 13:42:14 +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)
end
def notify_deletion_to_administration(deleted_dossier, to_email)
@deleted_dossier = deleted_dossier
2019-07-17 13:42:14 +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)
end
def notify_unhide_to_user(dossier)
@dossier = dossier
2019-07-17 13:42:14 +02:00
subject = "Votre dossier nº #{@dossier.id} n'a pas pu être supprimé"
mail(to: dossier.user.email, subject: subject)
end
def notify_undelete_to_user(dossier)
@dossier = dossier
@dossier_kind = dossier.brouillon? ? 'brouillon' : 'dossier'
2019-07-17 13:42:14 +02:00
@subject = "Votre #{@dossier_kind} #{@dossier.id} est à nouveau accessible"
mail(to: dossier.user.email, subject: @subject)
end
def notify_revert_to_instruction(dossier)
@dossier = dossier
2019-07-17 13:42:14 +02:00
@subject = "Votre dossier nº #{@dossier.id} est en train d'être réexaminé"
mail(to: dossier.user.email, subject: @subject)
end
end