diff --git a/app/javascript/components/TypesDeChampEditor/index.js b/app/javascript/components/TypesDeChampEditor/index.js index e9da90fcb..dff850ac6 100644 --- a/app/javascript/components/TypesDeChampEditor/index.js +++ b/app/javascript/components/TypesDeChampEditor/index.js @@ -22,7 +22,6 @@ class TypesDeChampEditor extends Component { type_champ: 'text', types_de_champ: [], private: props.isAnnotation, - drop_down_list_value: '--Premier élément du menu--\n', libelle: `${ props.isAnnotation ? 'Nouvelle annotation' : 'Nouveau champ' } ${props.typeDeChampsTypes[0][0]}` diff --git a/app/javascript/components/TypesDeChampEditor/typeDeChampsReducer.js b/app/javascript/components/TypesDeChampEditor/typeDeChampsReducer.js index c3e52c6b7..5d27c8399 100644 --- a/app/javascript/components/TypesDeChampEditor/typeDeChampsReducer.js +++ b/app/javascript/components/TypesDeChampEditor/typeDeChampsReducer.js @@ -115,6 +115,18 @@ function updateTypeDeChamp( { typeDeChamp, field, value }, done ) { + if (field == 'type_champ' && !typeDeChamp.drop_down_list_value) { + switch (value) { + case 'linked_drop_down_list': + typeDeChamp.drop_down_list_value = + '--Fromage--\nbleu de sassenage\npicodon\n--Dessert--\néclair\ntarte aux pommes\n'; + break; + case 'drop_down_list': + case 'multiple_drop_down_list': + typeDeChamp.drop_down_list_value = '--Premier élément du menu--\n'; + } + } + typeDeChamp[field] = value; getUpdateHandler(typeDeChamp, state)(done);