better default value for linked_drop_down_list

This commit is contained in:
simon lehericey 2019-07-09 15:58:20 +02:00
parent 370213dad6
commit f6c402deec
2 changed files with 12 additions and 1 deletions

View file

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

View file

@ -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);