demarches-normaliennes/app/models/mails/closed_mail.rb

39 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2020-08-06 16:35:45 +02:00
# == Schema Information
#
# Table name: closed_mails
#
# id :integer not null, primary key
# body :text
# subject :string
# created_at :datetime not null
# updated_at :datetime not null
# procedure_id :integer
#
2017-03-06 22:37:37 +01:00
module Mails
# accepte
class ClosedMail < ApplicationRecord
2017-03-06 22:37:37 +01:00
include MailTemplateConcern
belongs_to :procedure, optional: false
validates :subject, tags: true
validates :body, tags: true
SLUG = "closed_mail"
2021-05-26 15:16:30 +02:00
DISPLAYED_NAME = "Accusé dacceptation"
DEFAULT_SUBJECT = 'Votre dossier nº --numéro du dossier-- a été accepté (--libellé démarche--)'
DOSSIER_STATE = Dossier.states.fetch(:accepte)
def self.default_template_name_for_procedure(procedure)
attestation_template = procedure.attestation_template
2018-05-30 18:45:46 +02:00
if attestation_template&.activated?
"notification_mailer/default_templates/closed_mail_with_attestation"
else
"notification_mailer/default_templates/closed_mail"
end
end
2017-03-06 22:37:37 +01:00
end
end