mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
* fixed attachment statistics for sqlite * Split attachment path into internal and external path, so the external source URL can be retained after a file is downloaded * Make internal and external path for attachments nullable, to make clear that they have no internal or external path * Added migrations for nullable columns for postgres and mysql * Added migration for nullable internal and external pathes for sqlite * Added translations * Fixed upload error * Restrict length of filename badge in attachment edit view * Improved margins with badges in attachment edit * Added a link to view external version from attachment edit * Let media_url stay in API attachments responses for backward compatibility --------- Co-authored-by: jona <a@b.c> Co-authored-by: Jan Böhmer <mail@jan-boehmer.de>
91 lines
No EOL
5.1 KiB
Twig
91 lines
No EOL
5.1 KiB
Twig
{% import "helper.twig" as helper %}
|
|
|
|
<table class="table table-striped table-sm table-hover table-responsive-sm">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>{% trans %}attachment.name{% endtrans %}</th>
|
|
<th>{% trans %}attachment.attachment_type{% endtrans %}</th>
|
|
<th>{% trans %}attachment.file_name{% endtrans %}</th>
|
|
<th>{% trans %}attachment.file_size{% endtrans %}</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
|
|
{% for attachment in part.attachments %}
|
|
<tr>
|
|
<td>
|
|
{% import "components/attachments.macro.html.twig" as attachments %}
|
|
{{ attachments.attachment_icon(attachment, attachment_manager) }}
|
|
</td>
|
|
<td class="align-middle">{{ attachment.name }}</td>
|
|
<td class="align-middle">{{ attachment.attachmentType.fullPath }}</td>
|
|
<td class="align-middle">
|
|
{% if attachment.hasInternal() %}
|
|
{{ attachment.filename }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="align-middle h6">
|
|
{% if not attachment.hasInternal() %}
|
|
<span class="badge bg-primary">
|
|
<i class="fas fa-fw fa-globe"></i> {% trans %}attachment.external_only{% endtrans %}
|
|
</span>
|
|
{% elseif attachment_manager.internalFileExisting(attachment) %}
|
|
<span class="badge bg-secondary">
|
|
<i class="fas fa-hdd fa-fw"></i> {{ attachment_manager.humanFileSize(attachment) }}
|
|
</span>
|
|
{% else %}
|
|
<span class="badge bg-warning">
|
|
<i class="fas fa-exclamation-circle fa-fw"></i> {% trans %}attachment.file_not_found{% endtrans %}
|
|
</span>
|
|
{% endif %}
|
|
{% if attachment.secure %}
|
|
<br><span class="badge bg-success">
|
|
<i class="fas fa-fw fa-shield-alt"></i> {% trans %}attachment.secure{% endtrans %}
|
|
</span>
|
|
{% endif %}
|
|
{% if attachment == part.masterPictureAttachment %}
|
|
<br>
|
|
<span class="badge bg-primary">
|
|
<i class="fas fa-id-card"></i> {% trans %}attachment.preview{% endtrans %}
|
|
</span>
|
|
{% endif %}
|
|
</td>
|
|
|
|
<td><div class="btn-group" role="group" aria-label="">
|
|
<a {% if attachment.hasExternal() %}href="{{ attachment.externalPath }}"{% endif %} target="_blank"
|
|
class="btn btn-secondary {% if not attachment.hasExternal() %}disabled{% endif %}"
|
|
data-turbo="false" title="{% trans with {"%host%": attachment.host} %}attachment.view_external.view_at{% endtrans %}" rel="noopener">
|
|
<i class="fas fa-globe fa-fw"></i>
|
|
</a>
|
|
<a {% if attachment_manager.isInternalFileExisting(attachment) %}href="{{ entity_url(attachment, 'file_view') }}"{% endif %} target="_blank"
|
|
class="btn btn-secondary {% if not attachment_manager.isInternalFileExisting(attachment) or (attachment.secure and not is_granted("show_private", attachment)) %}disabled{% endif %}"
|
|
data-turbo="false" title="{% trans %}attachment.view_local{% endtrans %}" rel="noopener">
|
|
<i class="fas fa-eye fa-fw"></i>
|
|
</a>
|
|
<a {% if attachment_manager.isInternalFileExisting(attachment) %}href="{{ entity_url(attachment, 'file_download') }}"{% endif %} data-turbo="false"
|
|
class="btn btn-secondary {% if not attachment_manager.isInternalFileExisting(attachment) or (attachment.secure and not is_granted("show_private", attachment)) %}disabled{% endif %}"
|
|
title="{% trans %}attachment.download_local{% endtrans %}">
|
|
<i class="fas fa-download fa-fw"></i>
|
|
</a>
|
|
|
|
<div class="btn-group" role="group">
|
|
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-boundary="window">
|
|
</button>
|
|
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
|
|
<span class="text-muted dropdown-item-text" ><i class="fas fa-lightbulb fa-fw"></i> <b>ID:</b> {{ attachment.iD }}</span>
|
|
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}lastModified{% endtrans %}:</b> {{ helper.entity_last_modified(attachment) }}</span>
|
|
<span class="text-muted dropdown-item-text" ><i class="fas fa-calendar-plus fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ helper.entity_created_at(attachment) }}</span>
|
|
|
|
</div>
|
|
</div>
|
|
</div></td>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table> |