#4785 ajout d'une balise 'groupe instructeur'
This commit is contained in:
parent
c6bfcd5c2f
commit
059d80ea34
2 changed files with 43 additions and 1 deletions
|
@ -11,6 +11,13 @@ module TagsSubstitutionConcern
|
|||
target: :motivation,
|
||||
available_for_states: Dossier::TERMINE
|
||||
},
|
||||
{
|
||||
libelle: 'groupe instructeur',
|
||||
description: 'Le groupe instructeur en charge du dossier',
|
||||
lambda: -> (d) { d.groupe_instructeur.label },
|
||||
available?: -> (d) { d.procedure.routee? },
|
||||
available_for_states: Dossier::SOUMIS
|
||||
},
|
||||
{
|
||||
libelle: 'date de dépôt',
|
||||
description: 'Date du passage en construction du dossier par l’usager',
|
||||
|
@ -219,7 +226,19 @@ module TagsSubstitutionConcern
|
|||
def replace_tags_with_values_from_data(text, tags, data)
|
||||
if data.present?
|
||||
tags.reduce(text) do |acc, tag|
|
||||
replace_tag(acc, tag, data)
|
||||
# A tag is available by default.
|
||||
# If it has an :available? lambda, then we check its result to determine if the tag is available
|
||||
if tag.key?(:available?)
|
||||
tag_available = instance_exec(data, &tag[:available?])
|
||||
else
|
||||
tag_available = true
|
||||
end
|
||||
|
||||
if tag_available
|
||||
replace_tag(acc, tag, data)
|
||||
else
|
||||
text
|
||||
end
|
||||
end
|
||||
else
|
||||
text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue