{# Modal to display plain text content #} {# UPLOADED FILES #}
{% if (mode == 'view' and Entity.entityData.uploads) or mode == 'edit' %}
{# necessary div for flex #}

{% trans %}Attached file {% plural Entity.entityData.uploads|length %} Attached files {% endtrans %} ({{ Entity.entityData.uploads|length }})

{# id is used with data-toggle-target-extra #}
{# ADD NEW FILE #} {% if mode == 'edit' %}
{% if App.Config.configArr.debug -%} {%- endif %}
{% endif %} {# TABLE LAYOUT (0) #} {% if App.Users.userData.uploads_layout == 0 and Entity.entityData.uploads %} {% include 'filter-input-snippet.html' with {'target': 'uploadsTable'} %} {% for upload in Entity.entityData.uploads %} {# COMMENT #} {# CREATED AT #} {# FILESIZE #} {# ACTIONS #} {% endfor %}
{{ 'Filename'|trans }} {{ 'Comment'|trans }} {{ 'Creation date'|trans }} {{ 'Filesize'|trans }} {{ 'Actions'|trans }}
{% if upload.state == constant('Elabftw\\Enums\\State::Archived').value %} {# use a span as title doesn't work directly on i element #} {% endif %} {{ upload.real_name }} {% include('upload-comment.html') %}{{ upload.filesize|default('0')|formatBytes }} {% if loop.first %} {% endif %} {% if not upload.immutable %} {% if mode == 'edit' %} {# EDIT FILENAME #} {# UPLOAD NEW VERSION #} {% include('upload-replace-form.html') %} {% endif %} {% if not Entity.isReadOnly %} {# ARCHIVE #} {# DESTROY #} {% endif %} {% endif %}
{# DEFAULT LAYOUT (1) #} {% else %} {% for upload in Entity.entityData.uploads %} {% set ext = upload.real_name|getExt %}
{% if loop.first %} {% endif %}
{% include('upload-dropdown-menu.html') %} {% if upload.state == constant('Elabftw\\Enums\\State::Archived').value %}

{{ 'Archived'|trans }}

{% endif %} {# IMAGES #} {% if ext matches '/(jpg|jpeg|png|gif|tif|tiff|pdf|eps|svg|heic)$/i' %} {# don't make the thumbnail clickable if it's a tif #} {% if ext matches '/(jpg|jpeg|png|gif|pdf|eps|svg|heic)$/i' %} {% endif %} {# MOLFILES #} {% elseif ext == 'mol' %}
{# MOLECULES #} {% elseif ext in constant('Elabftw\\Elabftw\\Extensions::MOLECULE') %} {# build control dropdown to change the representation style #}
{# IMPORTANT: here the data-href has the storage first and the filename last or 3Dmol will get confused with the format #}
{# DNA #} {% elseif ext in constant('Elabftw\\Elabftw\\Extensions::DNA') %}
{# TEXT #} {% elseif ext matches '/(txt|md|json)$/i' %} {# VIDEO #} {% elseif ext matches '/(mp4|webm)$/i' %}
{# AUDIO #} {% elseif ext in constant('Elabftw\\Elabftw\\Extensions::AUDIO') %}
{# ANYTHING ELSE #} {% else %} {% endif %}

{{ upload.real_name }} {% if upload.filesize %} {{ upload.filesize|formatBytes }} - {% endif %} {{ upload.created_at }}


{% include('upload-comment.html') %}
{% include('upload-more-info.html') %}
{# end div.caption #} {% include('upload-replace-form.html') %}
{% endfor %} {% endif %}

{% endif %}
{# #filesdiv #}