diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index 1e4f9ad98..39e45487b 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -1,8 +1,6 @@ module MailTemplateConcern extend ActiveSupport::Concern - include Rails.application.routes.url_helpers - include ActionView::Helpers::UrlHelper include TagsSubstitutionConcern def subject_for_dossier(dossier) @@ -20,14 +18,7 @@ module MailTemplateConcern end end - private - def dossier_tags - super + [{ libelle: 'lien dossier', description: '', lambda: -> (d) { users_dossier_recapitulatif_link(d) } }] - end - - def users_dossier_recapitulatif_link(dossier) - url = users_dossier_recapitulatif_url(dossier) - link_to(url, url, target: '_blank') + super + dossier_tags_for_mail end end diff --git a/app/models/concerns/tags_substitution_concern.rb b/app/models/concerns/tags_substitution_concern.rb index 929175c3d..da7bd910d 100644 --- a/app/models/concerns/tags_substitution_concern.rb +++ b/app/models/concerns/tags_substitution_concern.rb @@ -1,6 +1,9 @@ module TagsSubstitutionConcern extend ActiveSupport::Concern + include Rails.application.routes.url_helpers + include ActionView::Helpers::UrlHelper + def tags if procedure.for_individual? identity_tags = individual_tags @@ -73,6 +76,15 @@ module TagsSubstitutionConcern end end + def dossier_tags_for_mail + [{ libelle: 'lien dossier', description: '', lambda: -> (d) { users_dossier_recapitulatif_link(d) } }] + end + + def users_dossier_recapitulatif_link(dossier) + url = users_dossier_recapitulatif_url(dossier) + link_to(url, url, target: '_blank') + end + def individual_tags [ { libelle: 'civilité', description: 'M., Mme', target: :gender },