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 } } } ]