[#3356] Let types de champ decide their tags
This commit is contained in:
parent
d67af741d5
commit
bcfc0f2535
2 changed files with 13 additions and 8 deletions
|
@ -167,15 +167,11 @@ module TagsSubstitutionConcern
|
||||||
end
|
end
|
||||||
|
|
||||||
def types_de_champ_tags(types_de_champ, available_for_states)
|
def types_de_champ_tags(types_de_champ, available_for_states)
|
||||||
types_de_champ.flat_map do |tdc|
|
tags = types_de_champ.flat_map(&:tags_for_template)
|
||||||
[
|
tags.each do |tag|
|
||||||
{
|
tag[:available_for_states] = available_for_states
|
||||||
libelle: tdc.libelle,
|
|
||||||
description: tdc.description,
|
|
||||||
available_for_states: available_for_states
|
|
||||||
}
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace_tags(text, dossier)
|
def replace_tags(text, dossier)
|
||||||
|
|
|
@ -174,6 +174,15 @@ class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tags_for_template
|
||||||
|
[
|
||||||
|
{
|
||||||
|
libelle: libelle,
|
||||||
|
description: description
|
||||||
|
}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def setup_procedure
|
def setup_procedure
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue