Skip to content

Commit

Permalink
deposit: Add allow-empty-files config available for deposit page
Browse files Browse the repository at this point in the history
* Expose `RECORDS_RESOURCES_ALLOW_EMPTY_FILES` for UI control
* Related to: inveniosoftware/invenio-rdm-records#1802
  • Loading branch information
Samk13 committed Sep 14, 2024
1 parent 672b948 commit d9136bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
value='{{ config.RDM_RECORDS_ALLOW_RESTRICTION_AFTER_GRACE_PERIOD | tojson }}'>
<input type="hidden" name="config-groups-enabled"
value='{{ config.USERS_RESOURCES_GROUPS_ENABLED | tojson }}'>
<input type="hidden" name="records-resources-allow-empty-files"
value='{{ config.RECORDS_RESOURCES_ALLOW_EMPTY_FILES | tojson }}'>

{%- if forms_config %}
<input type="hidden" name="deposits-config"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (C) 2020-2024 CERN.
// Copyright (C) 2020-2022 Northwestern University.
// Copyright (C) 2021-2022 Graz University of Technology.
// Copyright (C) 2022-2023 KTH Royal Institute of Technology.
// 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.
Expand Down Expand Up @@ -107,6 +107,7 @@ export class RDMDepositForm extends Component {
recordRestrictionGracePeriod,
allowRecordRestriction,
groupsEnabled,
allowEmptyFiles,
} = this.props;
const customFieldsUI = this.config.custom_fields.ui;
return (
Expand Down Expand Up @@ -164,12 +165,14 @@ export class RDMDepositForm extends Component {
config={this.config}
permissions={permissions}
filesLocked={filesLocked}
allowEmptyFiles={allowEmptyFiles}
>
<FileUploader
isDraftRecord={!record.is_published}
quota={this.config.quota}
decimalSizeDisplay={this.config.decimal_size_display}
showMetadataOnlyToggle={permissions?.can_manage_files}
allowEmptyFiles={allowEmptyFiles}
filesLocked={filesLocked}
/>
</Overridable>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -27,6 +28,7 @@ ReactDOM.render(
)}
allowRecordRestriction={getInputFromDOM("deposits-allow-record-restriction")}
groupsEnabled={getInputFromDOM("config-groups-enabled")}
allowEmptyFiles={getInputFromDOM("records-resources-allow-empty-files")}
/>
</OverridableContext.Provider>,
document.getElementById("deposit-form")
Expand Down

0 comments on commit d9136bf

Please sign in to comment.