Improved image and attachment viewing on part info page

This commit is contained in:
Jan Böhmer 2023-07-23 01:32:28 +02:00
parent 1de1eebc59
commit fc7e436ca9
3 changed files with 12 additions and 3 deletions

View file

@ -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 %}