leilukin-tumbleblog/admin/partials/uploads_modal.twig

39 lines
1.6 KiB
Twig
Raw Normal View History

2024-06-20 14:10:42 +00:00
<table>
<tbody>
{% for upload in uploads %}
<tr id="uploads_{{ loop.index }}" class="uploads">
<td class="uploads_name filename main">
{% if ["jpg", "jpeg", "png", "gif", "webp"] | contains(upload.type) %}
{{ upload.name | thumbnail("", false, ["max_width=70", "quality=60", "square=1"], "70px") }}
{% set file_url = site.chyrp_url ~ "/includes/thumbnail.php?file=" ~ (upload.name | url_encode) %}
{% elseif ["avif", "tif", "tiff", "bmp"] | contains(upload.type) %}
{{ icon_img("image.svg", "", "placeholder") }}
{% set file_url = site.chyrp_url ~ "/includes/thumbnail.php?file=" ~ (upload.name | url_encode) %}
{% elseif ["mp3", "m4a", "oga", "ogg", "mka", "flac", "wav"] | contains(upload.type) %}
{{ icon_img("audio.svg", "", "placeholder") }}
{% set file_url = upload.name | uploaded %}
{% elseif ["mpg", "mpeg", "mp2", "mp4", "m4v", "ogv", "mkv", "mov", "avi", "webm", "3gp", "ts"] | contains(upload.type) %}
{{ icon_img("video.svg", "", "placeholder") }}
{% set file_url = upload.name | uploaded %}
{% elseif ["zip", "tar", "rar", "gz", "bz2", "7z", "dmg", "cab", "iso", "udf"] | contains(upload.type) %}
{{ icon_img("archive.svg", "", "placeholder") }}
{% set file_url = upload.name | download %}
{% else %}
{{ icon_img("file.svg", "", "placeholder") }}
{% set file_url = upload.name | download %}
{% endif %}
<a data-name="{{ upload.name }}" data-type="{{ upload.type }}" data-size="{{ upload.size }}" href="{{ file_url }}">
{{ upload.name | fix }}
</a>
</td>
</tr>
{% else %}
<tr>
<td class="placeholder">
{{ icon_img("failure.svg", "", "emblem") }} {{ "No results" | translate }}
</td>
</tr>
{% endfor %}
</tbody>
</table>