Reorder some methods
This commit is contained in:
parent
a57e2388f6
commit
02c2f681aa
1 changed files with 16 additions and 16 deletions
|
@ -1,8 +1,8 @@
|
|||
class NotificationMailer < ApplicationMailer
|
||||
default to: Proc.new { @user.email }
|
||||
|
||||
def send_dossier_received(dossier)
|
||||
send_notification(dossier, dossier.procedure.received_mail_template)
|
||||
def new_answer(dossier)
|
||||
send_mail(dossier, "Nouveau message pour votre dossier demarches-simplifiees.fr nº #{dossier.id}")
|
||||
end
|
||||
|
||||
def send_draft_notification(dossier)
|
||||
|
@ -13,6 +13,10 @@ class NotificationMailer < ApplicationMailer
|
|||
mail(subject: subject)
|
||||
end
|
||||
|
||||
def send_dossier_received(dossier)
|
||||
send_notification(dossier, dossier.procedure.received_mail_template)
|
||||
end
|
||||
|
||||
def send_initiated_notification(dossier)
|
||||
send_notification(dossier, dossier.procedure.initiated_mail_template)
|
||||
end
|
||||
|
@ -29,11 +33,18 @@ class NotificationMailer < ApplicationMailer
|
|||
send_notification(dossier, dossier.procedure.without_continuation_mail_template)
|
||||
end
|
||||
|
||||
def new_answer(dossier)
|
||||
send_mail(dossier, "Nouveau message pour votre dossier demarches-simplifiees.fr nº #{dossier.id}")
|
||||
private
|
||||
|
||||
def vars_mailer(dossier)
|
||||
@dossier = dossier
|
||||
@user = dossier.user
|
||||
end
|
||||
|
||||
private
|
||||
def send_mail(dossier, subject)
|
||||
vars_mailer(dossier)
|
||||
|
||||
mail(subject: subject)
|
||||
end
|
||||
|
||||
def send_notification(dossier, mail_template)
|
||||
vars_mailer(dossier)
|
||||
|
@ -53,15 +64,4 @@ class NotificationMailer < ApplicationMailer
|
|||
body: ["[#{@subject}]", @body].join("<br><br>")
|
||||
)
|
||||
end
|
||||
|
||||
def vars_mailer(dossier)
|
||||
@dossier = dossier
|
||||
@user = dossier.user
|
||||
end
|
||||
|
||||
def send_mail(dossier, subject)
|
||||
vars_mailer(dossier)
|
||||
|
||||
mail(subject: subject)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue