{% set uploadsArr = Entity.Uploads.readAll %} {% if uploadsArr %}

{% trans %}Attached file {% plural uploadsArr|length %} Attached files {% endtrans %}

{% if mode == 'edit' %} {% endif %}
{% for upload in uploadsArr %} {% set ext = upload.real_name|getExt %}
{% if mode == 'edit' %} {% endif %} {% if upload.real_name matches '/\.(jpg|jpeg|png|gif|tif|tiff|pdf|eps|svg)$/i' %} thumbnail {% elseif ext == 'mol' and App.Users.userData.chem_editor %}
{% elseif ext in constant('Elabftw\\Elabftw\\Extensions::MOLECULE') %}
{% else %} {% endif %}
{{ upload.real_name }} {{ (Entity.Uploads.getUploadsPath ~ upload.long_name)|filesize|formatBytes }} - {{ upload.datetime }}
{# if we are in view mode, we don't show the comment if it's the default text. This is to avoid showing 'Click to add a comment' where in fact you can't click to add a comment because you are in view mode #} {% if mode == 'edit' or upload.comment != 'Click to add a comment' %}

{{ upload.comment}}

{% endif %} {# INSERT IN TEXT in edit mode for images #} {% if mode == 'edit' and ext matches '/(jpg|jpeg|png|gif|svg)$/i' %}

{{ 'Insert in text at cursor position'|trans }}

{% endif %} {# SAVE AS IMAGE #} {% if mode == 'edit' and ext matches '/(mol)$/i' %}

{{ 'Save as image'|trans }}

{% endif %}
{% if mode == 'edit' %}

{{ 'Upload a new version of this file'|trans }}

{% endif %}
{% endfor %}
{% endif %}