Skip to content

Commit bdd2ff5

Browse files
committed
files: hide archive button over the size cap
1 parent 96f9d52 commit bdd2ff5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros

invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/files.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ <h3 class="active title panel-heading {{ record.ui.access_status.id }} m-0">
9999
<th class>
100100
{%- if config.RDM_ARCHIVE_DOWNLOAD_ENABLED %}
101101
{% set archive_download_url = record.links.archive_media if is_media else record.links.archive %}
102-
<a role="button" class="ui compact mini button right floated archive-link" href="{{ archive_download_url }}">
103-
<i class="file archive icon button" aria-hidden="true"></i> {{_("Download all")}}
104-
</a>
102+
{%- set archive_max_size = config.RECORDS_RESOURCES_ARCHIVE_DOWNLOAD_MAX_SIZE %}
103+
{%- set archive_total_bytes = files|map(attribute='size', default=0)|sum() %}
104+
{%- if not archive_max_size or archive_total_bytes <= archive_max_size %}
105+
<a role="button" class="ui compact mini button right floated archive-link" href="{{ archive_download_url }}">
106+
<i class="file archive icon button" aria-hidden="true"></i> {{_("Download all")}}
107+
</a>
108+
{%- endif %}
105109
{%- endif %}
106110
</th>
107111
</tr>

0 commit comments

Comments
 (0)