Mails: factorize default and change slug

This commit is contained in:
Simon Lehericey 2017-03-06 23:18:16 +01:00
parent 02bbf0543f
commit 65e83dd6ec
14 changed files with 19 additions and 44 deletions

View file

@ -2,14 +2,8 @@ module Mails
class ClosedMail < ActiveRecord::Base
include MailTemplateConcern
def name
"Accusé d'acceptation"
end
DISPLAYED_NAME = "Accusé d'acceptation"
DEFAULT_OBJECT = 'Votre dossier TPS N°--numero_dossier-- a été accepté'
def self.default
obj = "Votre dossier TPS N°--numero_dossier-- a été accepté"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/closed_mail')
ClosedMail.new(object: obj, body: body)
end
end
end

View file

@ -2,14 +2,8 @@ module Mails
class InitiatedMail < ActiveRecord::Base
include MailTemplateConcern
def name
"Accusé de réception"
end
DISPLAYED_NAME = 'Accusé de réception'
DEFAULT_OBJECT = 'Votre dossier TPS N°--numero_dossier-- a été bien reçu'
def self.default
obj = "Votre dossier TPS N°--numero_dossier-- a été bien reçu"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/initiated_mail')
InitiatedMail.new(object: obj, body: body)
end
end
end

View file

@ -2,14 +2,8 @@ module Mails
class ReceivedMail < ActiveRecord::Base
include MailTemplateConcern
def name
"Accusé de passage en instruction"
end
DISPLAYED_NAME = 'Accusé de passage en instruction'
DEFAULT_OBJECT = 'Votre dossier TPS N°--numero_dossier-- va être instruit'
def self.default
obj = "Votre dossier TPS N°--numero_dossier-- va être instruit"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/received_mail')
ReceivedMail.new(object: obj, body: body)
end
end
end

View file

@ -2,14 +2,8 @@ module Mails
class RefusedMail < ApplicationRecord
include MailTemplateConcern
def name
"Accusé de rejet du dossier"
end
DISPLAYED_NAME = 'Accusé de rejet du dossier'
DEFAULT_OBJECT = 'Votre dossier TPS N°--numero_dossier-- a été refusé'
def self.default
obj = "Votre dossier TPS N°--numero_dossier-- a été refusé"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/refused_mail')
RefusedMail.new(object: obj, body: body)
end
end
end

View file

@ -2,14 +2,8 @@ module Mails
class WithoutContinuationMail < ApplicationRecord
include MailTemplateConcern
def name
"Accusé de classement sans suite"
end
DISPLAYED_NAME = 'Accusé de classement sans suite'
DEFAULT_OBJECT = 'Votre dossier TPS N°--numero_dossier-- a été classé sans suite'
def self.default
obj = "Votre dossier TPS N°--numero_dossier-- a été classé sans suite"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/without_continuation_mail')
WithoutContinuationMail.new(object: obj, body: body)
end
end
end