2017-03-06 11:51:34 +01:00
|
|
|
module MailTemplateConcern
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2018-01-04 10:37:40 +01:00
|
|
|
include TagsSubstitutionConcern
|
2017-05-03 11:46:41 +02:00
|
|
|
|
2018-01-08 17:26:13 +01:00
|
|
|
def subject_for_dossier(dossier)
|
|
|
|
replace_tags(subject, dossier)
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
|
2017-05-03 11:58:34 +02:00
|
|
|
def body_for_dossier(dossier)
|
2017-03-06 11:51:34 +01:00
|
|
|
replace_tags(body, dossier)
|
|
|
|
end
|
|
|
|
|
|
|
|
module ClassMethods
|
2017-12-22 21:37:08 +01:00
|
|
|
def default_for_procedure(procedure)
|
2017-05-27 01:16:38 +02:00
|
|
|
body = ActionController::Base.new.render_to_string(template: self.const_get(:TEMPLATE_NAME))
|
2018-01-08 17:26:13 +01:00
|
|
|
self.new(subject: self.const_get(:DEFAULT_SUBJECT), body: body, procedure: procedure)
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-01-04 10:37:40 +01:00
|
|
|
def dossier_tags
|
2018-01-18 11:52:48 +01:00
|
|
|
TagsSubstitutionConcern::DOSSIER_TAGS + TagsSubstitutionConcern::DOSSIER_TAGS_FOR_MAIL
|
2017-03-06 11:51:34 +01:00
|
|
|
end
|
|
|
|
end
|