[#3356] Let types de champ decide their tags

This commit is contained in:
Frederic Merizen 2019-02-05 13:00:58 +01:00 committed by simon lehericey
parent d67af741d5
commit bcfc0f2535
2 changed files with 13 additions and 8 deletions

View file

@ -167,15 +167,11 @@ module TagsSubstitutionConcern
end
def types_de_champ_tags(types_de_champ, available_for_states)
types_de_champ.flat_map do |tdc|
[
{
libelle: tdc.libelle,
description: tdc.description,
available_for_states: available_for_states
}
]
tags = types_de_champ.flat_map(&:tags_for_template)
tags.each do |tag|
tag[:available_for_states] = available_for_states
end
tags
end
def replace_tags(text, dossier)

View file

@ -174,6 +174,15 @@ class TypeDeChamp < ApplicationRecord
end
end
def tags_for_template
[
{
libelle: libelle,
description: description
}
]
end
private
def setup_procedure