Files
devplacepy/devplacepy/templates/_attachment_display.html
T
retoor 6b08761af5 feat: add audio file support and expand allowed upload types with new MIME mappings
Extend ALLOWED_UPLOAD_TYPES dict with audio formats (wav, flac, ogg, aac, wma, m4a), video formats (avi, mkv, flv, wmv, 3gp), document formats (doc, docx, xls, xlsx, ppt, pptx, odt, rtf), code formats (ts, java, cpp, c, h, rb, go, rs, sql, php, swift, kt), config formats (cfg, ini, log), archive formats (tar, gz, rar, 7z), and additional web formats (html, json, xml, yaml, yml, toml, sh, bat, svg). Add corresponding MIME_TO_EXT reverse mappings. Implement audio element rendering in ContentRenderer.js with audioExtRe regex and createAudioElement method. Add gallery-audio CSS class for audio player styling in attachments.css and media.css. Update _attachment_display.html and _media_gallery.html templates to render audio controls for is_audio attachments.
2026-06-15 15:08:10 +00:00

22 lines
1.4 KiB
HTML

<div class="attachment-gallery">
{% for att in attachments %}
<div class="attachment-gallery-item">
{% if att.get('is_image') and att.get('thumbnail_url') %}
<img src="{{ att['thumbnail_url'] }}" alt="{{ att.get('original_filename', '') }}" loading="lazy" class="gallery-thumb" data-lightbox data-full="{{ att['url'] }}" data-mime="{{ att.get('mime_type', '') }}">
{% elif att.get('is_image') %}
<img src="{{ att['url'] }}" alt="{{ att.get('original_filename', '') }}" loading="lazy" class="gallery-thumb" data-lightbox data-full="{{ att['url'] }}" data-mime="{{ att.get('mime_type', '') }}">
{% elif att.get('is_video') %}
<video src="{{ att['url'] }}" controls preload="metadata" class="gallery-video"></video>
{% elif att.get('is_audio') %}
<audio src="{{ att['url'] }}" controls preload="metadata" class="gallery-audio"></audio>
{% else %}
<a href="{{ att['url'] }}" target="_blank" rel="noopener" class="non-image" download="{{ att.get('original_filename', 'file') }}">
<span class="icon">{{ file_icon_emoji(att.get('original_filename', 'file')) }}</span>
<span class="name">{{ att.get('original_filename', 'file') }}</span>
<span class="size">{{ format_file_size(att.get('file_size', 0)) }}</span>
</a>
{% endif %}
</div>
{% endfor %}
</div>