From c27e675152b095a3a77c10a9e27d87a90a79ca85 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 30 Jan 2025 14:55:11 +0100 Subject: [PATCH] fix: allow to set choices for a nullablechoices field fix #2380 --- umap/static/umap/js/modules/form/fields.js | 12 +++++++----- umap/static/umap/js/modules/schema.js | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/umap/static/umap/js/modules/form/fields.js b/umap/static/umap/js/modules/form/fields.js index 2223173e..d04b4196 100644 --- a/umap/static/umap/js/modules/form/fields.js +++ b/umap/static/umap/js/modules/form/fields.js @@ -1191,11 +1191,13 @@ Fields.TernaryChoices = class extends Fields.MultiChoice { Fields.NullableChoices = class extends Fields.TernaryChoices { getChoices() { - return [ - [true, translate('always')], - [false, translate('never')], - ['null', translate('hidden')], - ] + return ( + this.properties.choices || [ + [true, translate('always')], + [false, translate('never')], + ['null', translate('hidden')], + ] + ) } } diff --git a/umap/static/umap/js/modules/schema.js b/umap/static/umap/js/modules/schema.js index 99a8645a..3dacf79d 100644 --- a/umap/static/umap/js/modules/schema.js +++ b/umap/static/umap/js/modules/schema.js @@ -447,6 +447,11 @@ export const SCHEMA = { label: translate('Display label'), inheritable: true, default: false, + choices: [ + [true, translate('always')], + [false, translate('never')], + ['null', translate('on hover')], + ], }, slideshow: { type: Object,