{# -*- coding: utf-8 -*- Copyright (C) 2020 CERN. Copyright (C) 2020 Northwestern University. Copyright (C) 2021, 2023 Graz University of Technology. Copyright (C) 2021 TU Wien. invenio-records-lom is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. For the original code see the NOTE below. #} {# NOTE: copy pasted code from invenio_app_rdm/records/macros/files.html it was necessary to copy paste it to override the endpoint from invenio_app_rdm_records to invenio_records_lom #} {%- macro preview_file(preview_endpoint, pid_value, filename, is_preview, id='preview-iframe', width='100%', height='400' ) %} {% if is_preview %} {%- set preview_url = url_for(preview_endpoint, pid_value=pid_value, filename=filename, preview=1) -%} {% else %} {%- set preview_url = url_for(preview_endpoint, pid_value=pid_value, filename=filename) -%} {% endif %} {%- endmacro %} {% macro lom_preview_file_box(file, pid, is_preview, record) %}
{{_('Name')}} | {{_('Size')}} | {# TODO: invenio does archive-download here; if that were implemented for lom-records, we can use invenio's macro and remove this macro... #}|
---|---|---|
{{ file.checksum }}
|
{{ file.size|filesizeformat(binary=not config.APP_RDM_DISPLAY_DECIMAL_FILE_SIZES) }} | {% if with_preview and file_type|lower is previewable %} {{_("Preview")}} {% endif %} {{_('Download')}} |