Merge pull request #1177 from sgmap/fix_1110-remove_legacy_tags
Fix 1110 5. remove legacy tags
This commit is contained in:
commit
45e5f77e52
2 changed files with 6 additions and 23 deletions
|
@ -13,10 +13,8 @@ module MailTemplateConcern
|
||||||
replace_tags(body, dossier)
|
replace_tags(body, dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: remove legacy argument when removing legacy tags
|
def tags(is_dossier_termine: self.class.const_get(:IS_DOSSIER_TERMINE))
|
||||||
def tags(reject_legacy: true, is_dossier_termine: self.class.const_get(:IS_DOSSIER_TERMINE))
|
super
|
||||||
super(is_dossier_termine: is_dossier_termine)
|
|
||||||
.reject { |tag| reject_legacy && tag[:is_legacy] }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
@ -29,15 +27,7 @@ module MailTemplateConcern
|
||||||
private
|
private
|
||||||
|
|
||||||
def dossier_tags
|
def dossier_tags
|
||||||
super +
|
super + [{ libelle: 'lien dossier', description: '', lambda: -> (d) { users_dossier_recapitulatif_link(d) } }]
|
||||||
[{ libelle: 'lien dossier', description: '', lambda: -> (d) { users_dossier_recapitulatif_link(d) } },
|
|
||||||
# TODO: remove legacy tags
|
|
||||||
{ libelle: 'numero_dossier', description: '', target: :id, is_legacy: true },
|
|
||||||
{ libelle: 'lien_dossier', description: '', lambda: -> (d) { users_dossier_recapitulatif_link(d) }, is_legacy: true },
|
|
||||||
{ libelle: 'libelle_procedure', description: '', lambda: -> (d) { d.procedure.libelle }, is_legacy: true },
|
|
||||||
{ libelle: 'date_de_decision', description: '',
|
|
||||||
lambda: -> (d) { d.processed_at.present? ? d.processed_at.localtime.strftime('%d/%m/%Y') : '' },
|
|
||||||
dossier_termine_only: true, is_legacy: true }]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def users_dossier_recapitulatif_link(dossier)
|
def users_dossier_recapitulatif_link(dossier)
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||||
describe 'admin/mail_templates/edit.html.haml', type: :view do
|
describe 'admin/mail_templates/edit.html.haml', type: :view do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
let(:mail_template) { create(:mail_template, procedure: procedure) }
|
let(:mail_template) { create(:mail_template, procedure: procedure) }
|
||||||
let(:all_tags) { mail_template.tags(reject_legacy: false) }
|
let(:all_tags) { mail_template.tags }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(view).to receive(:admin_procedure_mail_template_path).and_return("/toto")
|
allow(view).to receive(:admin_procedure_mail_template_path).and_return("/toto")
|
||||||
|
@ -12,15 +12,8 @@ describe 'admin/mail_templates/edit.html.haml', type: :view do
|
||||||
assign(:mail_template, mail_template)
|
assign(:mail_template, mail_template)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { render }
|
context "Champs are listed in the page" do
|
||||||
|
|
||||||
context "Legacy champs are not listed in the page" do
|
|
||||||
it { expect(all_tags).to include(include({ libelle: 'numero_dossier', is_legacy: true })) }
|
|
||||||
it { is_expected.not_to include("numero_dossier") }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "Non-legacy champs are listed in the page" do
|
|
||||||
it { expect(all_tags).to include(include({ libelle: 'numéro du dossier' })) }
|
it { expect(all_tags).to include(include({ libelle: 'numéro du dossier' })) }
|
||||||
it { is_expected.to include("numéro du dossier") }
|
it { expect(render).to include("numéro du dossier") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue