diff --git a/templates/Parts/info/_attachments_info.html.twig b/templates/Parts/info/_attachments_info.html.twig index 4472a6ad..4f8e3b81 100644 --- a/templates/Parts/info/_attachments_info.html.twig +++ b/templates/Parts/info/_attachments_info.html.twig @@ -1,5 +1,3 @@ -{% import "helper.twig" as helper %} -
- {{ helper.attachment_icon(attachment, attachment_manager) }} + {% import "components/attachments.macro.html.twig" as attachments %} + {{ attachments.attachment_icon(attachment, attachment_manager) }} | {{ attachment.name }} | {{ attachment.attachmentType.fullPath }} | diff --git a/templates/components/attachments.macro.html.twig b/templates/components/attachments.macro.html.twig index 7194c5ad..d30579d9 100644 --- a/templates/components/attachments.macro.html.twig +++ b/templates/components/attachments.macro.html.twig @@ -17,4 +17,23 @@ {% trans %}attachment.create{% endtrans %} +{% endmacro %} + +{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %} + {% set disabled = attachment.secure and not is_granted("show_secure", attachment) %} + {% if not attachment_helper or attachment_helper.fileExisting(attachment) %} + {% if link and not disabled %} + + {% endif %} + {% if attachment.picture %} +