{# Copyright (C) 2020-2024 CERN. Copyright (C) 2023 Northwestern University. Copyright (C) 2021 Graz University of Technology. Copyright (C) 2021 TU Wien. Copyright (C) New York University. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {%- macro preview_file(preview_endpoint, pid_value, filename, is_preview, include_deleted, id='preview-iframe' ) %} {%- set include_deleted_value = 0 -%} {% if include_deleted %} {%- set include_deleted_value = 1 -%} {% endif %} {% if is_preview %} {%- set preview_url = url_for(preview_endpoint, pid_value=pid_value, filename=filename, preview=1, include_deleted=include_deleted_value) -%} {% else %} {%- set preview_url = url_for(preview_endpoint, pid_value=pid_value, filename=filename, include_deleted=include_deleted_value) -%} {% endif %} {%- endmacro %} {% macro preview_file_box(file, pid, is_preview, record, include_deleted) %} {%- set is_remote_file = file.transfer.type == transfer_types.REMOTE %}
{{_('Name')}} | {{_('Size')}} | {%- if config.RDM_ARCHIVE_DOWNLOAD_ENABLED %} {% set archive_download_url = record.links.archive_media if is_media else record.links.archive %} {{_("Download all")}} {%- endif %} |
---|---|---|
{%- if not is_remote_file %}
{{ file.checksum }}
|
{%- if is_remote_file %}{{_("N/A (external)")}}{%- else -%}{{ file.size|filesizeformat(binary=binary_sizes) }}{%- endif %} | {% if with_preview and file_type|lower is previewable and not is_remote_file %} {{_("Preview")}} {% endif %} {{_('Download')}} |