diff --git a/CHANGELOG.md b/CHANGELOG.md index 90403c3d6e9a42780e29bfa97b398c534bc97c99..095ef096dea69bfce7ff7df78cc5069303be762e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Uncaught exception in dropdown menus of the edit mode when pressing arrow down or arrow up. +* Hidden boolean select in edit mode. ### Security diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js index 8b7e5fabb075a87e1ddf92d5d568abea589e6ddc..63b28b08a6c07d4c5b00795f5e9f87d1965e4031 100644 --- a/src/core/js/edit_mode.js +++ b/src/core/js/edit_mode.js @@ -986,30 +986,33 @@ var edit_mode = new function () { result = "<input type='number' step='any' value='" + property.value + "'></input>"; } else if (property.datatype == "INTEGER") { result = "<input type='number' value='" + property.value + "'></input>"; - } else if (property.datatype == "BOOLEAN") { - result = $(`<select class="selectpicker form-control caosdb-list-${property.datatype}"><option value=""></option><option>FALSE</option><option>TRUE</option></select>`); - if(property.value) { - result.val(property.value); - } - } else if (property.reference || property.datatype == "FILE") { - result = $('<div/>'); - var css = { - "min-height": "38px", - "width": "80%", - "display": "inline-block", - }; - result.css(css); - result.append(`<select style="display: none"><option selected>${property.value}</option></select>`); - result.append(createWaitingNotification(property.value)); - - const select = $('<select data-container="body" data-virtual-scroll="100" data-window-padding="15" data-live-search="true" class="selectpicker form-control caosdb-list-' + property.datatype + '" data-resolved="false"><option value=""></option></select>'); - options.then((_options) => { - edit_mode.fill_reference_drop_down(select[0], _options, property.value); - result.empty(); - result.append(select); - edit_mode._init_select(select); - }); + } else if (property.datatype == "BOOLEAN" || property.datatype == "FILE" || property.reference) { + result = $('<div/>'); + var css = { + "min-height": "38px", + "width": "80%", + "display": "inline-block", + }; + result.css(css); + if (property.datatype == "BOOLEAN") { + const select = $(`<select data-container="body" class="selectpicker form-control caosdb-list-${property.datatype}"><option value=""></option><option>FALSE</option><option>TRUE</option></select>`); + if (property.value) { + select.val(property.value); + } + result.append(select); + } else { // references and files + result.append(`<select style="display: none"><option selected>${property.value}</option></select>`); + result.append(createWaitingNotification(property.value)); + + const select = $('<select data-container="body" data-virtual-scroll="100" data-window-padding="15" data-live-search="true" class="selectpicker form-control caosdb-list-' + property.datatype + '" data-resolved="false"><option value=""></option></select>'); + options.then((_options) => { + edit_mode.fill_reference_drop_down(select[0], _options, property.value); + result.empty(); + result.append(select); + edit_mode._init_select(select); + }); + } } else { throw ("Unsupported data type: `" + property.datatype + "`. Please issue a feature request."); } @@ -2094,4 +2097,4 @@ var edit_mode = new function () { */ $(document).ready(function () { edit_mode.init(); -}); +}); \ No newline at end of file diff --git a/test/core/js/modules/edit_mode.js.js b/test/core/js/modules/edit_mode.js.js index 17b32023627cc557e204e4cab3300f7092d78fad..6f762aaa168acfaca79141617f0027726fde7c67 100644 --- a/test/core/js/modules/edit_mode.js.js +++ b/test/core/js/modules/edit_mode.js.js @@ -821,7 +821,7 @@ QUnit.test("_toggle_list_property", async function (assert) { var val = $(single_input).val(); if (dt == "DATETIME") { val = $(single_input).find("[type='date']").val() + "T" + $(single_input).find("[type='time']").val(); - } else if (["Person", "FILE", "REFERENCE"].indexOf(dt) > -1) { + } else if (["BOOLEAN", "Person", "FILE", "REFERENCE"].indexOf(dt) > -1) { val = $(single_input).find("select").val(); } assert.equal(val, data[`LIST<${dt}>`], `single ${dt} input has correct value`);