From 48f8ba23f27fd69eb060f7ef3f153b55dd420db2 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Sat, 14 Sep 2024 04:42:20 +0200 Subject: [PATCH] deposit: Add allow-empty-files config available for deposit page * Expose `RECORDS_RESOURCES_ALLOW_EMPTY_FILES` for UI control * Related to: https://github.com/inveniosoftware/invenio-rdm-records/pull/1802 --- .../semantic-ui/invenio_app_rdm/records/deposit.html | 2 ++ .../js/invenio_app_rdm/deposit/RDMDepositForm.js | 7 ++++++- .../assets/semantic-ui/js/invenio_app_rdm/deposit/index.js | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html index 994c37953..a0b19e209 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html @@ -47,6 +47,8 @@ value='{{ config.RDM_RECORDS_ALLOW_RESTRICTION_AFTER_GRACE_PERIOD | tojson }}'> + {%- if forms_config %} @@ -707,6 +710,7 @@ RDMDepositForm.propTypes = { files: PropTypes.object, permissions: PropTypes.object, filesLocked: PropTypes.bool, + allowEmptyFiles: PropTypes.bool, }; RDMDepositForm.defaultProps = { @@ -714,4 +718,5 @@ RDMDepositForm.defaultProps = { permissions: null, files: null, filesLocked: false, + allowEmptyFiles: true, }; diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js index f81e9a02f..2005fa220 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js @@ -1,6 +1,7 @@ // This file is part of InvenioRDM // Copyright (C) 2020-2024 CERN. // Copyright (C) 2020-2022 Northwestern University. +// Copyright (C) 2022-2024 KTH Royal Institute of Technology. // // Invenio App RDM is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -27,6 +28,7 @@ ReactDOM.render( )} allowRecordRestriction={getInputFromDOM("deposits-allow-record-restriction")} groupsEnabled={getInputFromDOM("config-groups-enabled")} + allowEmptyFiles={getInputFromDOM("records-resources-allow-empty-files")} /> , document.getElementById("deposit-form")