From 610d2e7e2b3d315790a2535d673a401e660225a7 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Fri, 8 Mar 2019 12:51:08 +0100 Subject: [PATCH] [Fix #3572] Use champ with correct type for balise --- .../linked_drop_down_list_type_de_champ.rb | 10 +++++----- app/models/types_de_champ/type_de_champ_base.rb | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb index 50f4aa111..3b6e32ad8 100644 --- a/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb +++ b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb @@ -23,25 +23,25 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas def tags_for_template tags = super - l = libelle + tdc = @type_de_champ tags.push( { - libelle: "#{l}/primaire", + libelle: "#{libelle}/primaire", description: "#{description} (menu primaire)", lambda: -> (champs) { champs - .detect { |champ| champ.libelle == l } + .detect { |champ| champ.type_de_champ == tdc } &.primary_value } } ) tags.push( { - libelle: "#{l}/secondaire", + libelle: "#{libelle}/secondaire", description: "#{description} (menu secondaire)", lambda: -> (champs) { champs - .detect { |champ| champ.libelle == l } + .detect { |champ| champ.type_de_champ == tdc } &.secondary_value } } diff --git a/app/models/types_de_champ/type_de_champ_base.rb b/app/models/types_de_champ/type_de_champ_base.rb index 410663aa3..8d808df2a 100644 --- a/app/models/types_de_champ/type_de_champ_base.rb +++ b/app/models/types_de_champ/type_de_champ_base.rb @@ -8,13 +8,13 @@ class TypesDeChamp::TypeDeChampBase end def tags_for_template - l = libelle + tdc = @type_de_champ [ { - libelle: l, + libelle: libelle, description: description, lambda: -> (champs) { - champs.detect { |champ| champ.libelle == l } + champs.detect { |champ| champ.type_de_champ == tdc } } } ]