mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-09 09:54:33 +02:00
Improved image and attachment viewing on part info page
This commit is contained in:
parent
1de1eebc59
commit
fc7e436ca9
3 changed files with 12 additions and 3 deletions
|
@ -58,6 +58,14 @@ class PartPreviewGenerator
|
|||
$list[] = $attachment;
|
||||
}
|
||||
|
||||
//Then comes the other images of the part
|
||||
foreach ($part->getAttachments() as $attachment) {
|
||||
//Dont show the master attachment twice
|
||||
if ($this->isAttachmentValidPicture($attachment) && $attachment !== $part->getMasterPictureAttachment()) {
|
||||
$list[] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
if ($part->getFootprint() instanceof Footprint) {
|
||||
$attachment = $part->getFootprint()->getMasterPictureAttachment();
|
||||
if ($this->isAttachmentValidPicture($attachment)) {
|
||||
|
|
|
@ -19,14 +19,15 @@
|
|||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x hoverpic", link = true) %}
|
||||
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-2x hoverpic", link = true) %}
|
||||
{# @var App\Entity\Attachments\Attachment attachment #}
|
||||
{% set disabled = attachment.secure and not is_granted("show_private", attachment) %}
|
||||
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
|
||||
{% if link and not disabled %}
|
||||
<a target="_blank" data-turbo="false" rel="noopener" href="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% endif %}
|
||||
{% if attachment.picture %}
|
||||
<img class="hoverpic" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ entity_url(attachment, 'file_view') }}" src="{{ entity_url(attachment, 'file_view') }}">
|
||||
<img class="hoverpic" {{ stimulus_controller('elements/hoverpic') }} data-title="{{ attachment.name }}" data-thumbnail="{{ entity_url(attachment, 'file_view') }}" src="{{ entity_url(attachment, 'file_view') }}">
|
||||
{% else %}
|
||||
<i class="text-dark {{ class }} {{ ext_to_fa_icon(attachment.extension) }}"></i>
|
||||
{% endif %}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<img class="d-block w-100 img-fluid img-thumbnail bg-light part-info-image" src="{{ entity_url(pic, 'file_view') }}" alt="">
|
||||
<div class="mask"></div>
|
||||
<div class="carousel-caption-hover">
|
||||
<div class="carousel-caption text-body ">
|
||||
<div class="carousel-caption text-white">
|
||||
<div><b>{{ pic.name }}</b></div>
|
||||
<div>{% if pic.filename %}({{ pic.filename }}) {% endif %}</div>
|
||||
<div>{{ entity_type_label(pic.element) }}</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue