Merge pull request #4068 from betagouv/better_default_value_for_linked_list
better default value for linked_drop_down_list
This commit is contained in:
commit
7a53ca127c
2 changed files with 12 additions and 1 deletions
|
@ -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]}`
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue