-
- {% trans %}attachment.file_not_found{% endtrans %}
-
-
- {% endif %}
-
- {% if attach.secure %}
-
-
- {% trans %}attachment.secure{% endtrans %}
-
-
- {% endif %}
-
-
-
- {% endfor %}
-
-
-
-
-
-
\ No newline at end of file
+{{ attachments.attachment_edit_list(form.attachments) }}
\ No newline at end of file
diff --git a/templates/Form/extendedBootstrap4_layout.html.twig b/templates/Form/extendedBootstrap4_layout.html.twig
index aec3a427..dbac4b10 100644
--- a/templates/Form/extendedBootstrap4_layout.html.twig
+++ b/templates/Form/extendedBootstrap4_layout.html.twig
@@ -115,7 +115,7 @@
{%- block choice_widget_collapsed -%}
{# Only add the BS5 form-select class if we dont use bootstrap-selectpicker #}
- {% if attr["data-controller"] is defined and attr["data-controller"] != "elements--selectpicker" %}
+ {% if attr["data-controller"] is defined and attr["data-controller"] not in ["elements--selectpicker"] %}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%}
{% else %}
{# If it is an selectpicker add form-control class to fill whole width #}
diff --git a/templates/Parts/edit/_attachments.html.twig b/templates/Parts/edit/_attachments.html.twig
index 5c7588c2..ccd0c3eb 100644
--- a/templates/Parts/edit/_attachments.html.twig
+++ b/templates/Parts/edit/_attachments.html.twig
@@ -1,112 +1,5 @@
-{% set delete_btn %}
-
-{% endset %}
+{% import "components/attachments.macro.html.twig" as attachments %}
{{ form_row(form.master_picture_attachment) }}
-
-
- {% for attachment in form.attachments %}
-
-
- {{ form_widget(attachment) }}
-
-
- {{ delete_btn }}
-
- {% set attach = attachment.vars.value %}
-
- {% if attachment_manager.fileExisting(attach) %}
- {% if not attach.external %}
-
-
- {% trans %}attachment.file_not_found{% endtrans %}
-
-
- {% endif %}
-
- {% if attach.secure %}
-
-
- {% trans %}attachment.secure{% endtrans %}
-
-
- {% endif %}
-
-
-
- {% endfor %}
-
-
-
-
-
-
\ No newline at end of file
+{{ attachments.attachment_edit_list(form.attachments) }}
\ No newline at end of file
diff --git a/templates/Parts/edit/edit_form_styles.html.twig b/templates/Parts/edit/edit_form_styles.html.twig
index 050470c1..cf15c809 100644
--- a/templates/Parts/edit/edit_form_styles.html.twig
+++ b/templates/Parts/edit/edit_form_styles.html.twig
@@ -101,4 +101,74 @@
{{ form_errors(form) }}
+{% endblock %}
+
+{% block attachment_widget %}
+ {% import 'components/collection_type.macro.html.twig' as collection %}
+
+ {% dump(form) %}
+
+
+
+ {{ form_widget(form) }}
+
+
+
+
+ {% set attach = form.vars.value %}
+
+ {% if attach is not null %}
+ {% if attachment_manager.fileExisting(attach) %}
+ {% if not attach.external %}
+
+
+ {% trans %}attachment.file_not_found{% endtrans %}
+
+
+ {% endif %}
+
+ {% if attach.secure %}
+
+
+ {% trans %}attachment.secure{% endtrans %}
+
+
+ {% endif %}
+ {% endif %}
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/templates/components/attachments.macro.html.twig b/templates/components/attachments.macro.html.twig
new file mode 100644
index 00000000..7194c5ad
--- /dev/null
+++ b/templates/components/attachments.macro.html.twig
@@ -0,0 +1,20 @@
+{# Renders a editable list of all attachments. form is the Attachment CollectionType #}
+{% macro attachment_edit_list(form, part_mode = false) %}
+ {% form_theme form with ['Parts/edit/edit_form_styles.html.twig'] %}
+
+ {% import 'components/collection_type.macro.html.twig' as collection %}
+
+
+
+ {% for attachment in form %}
+ {{ form_widget(attachment) }}
+ {% endfor %}
+
+
+
+
+
+{% endmacro %}
\ No newline at end of file
diff --git a/templates/components/collection_type.macro.html.twig b/templates/components/collection_type.macro.html.twig
index fa186b2e..c895987d 100644
--- a/templates/components/collection_type.macro.html.twig
+++ b/templates/components/collection_type.macro.html.twig
@@ -1,6 +1,6 @@
{% macro controller(form, deleteMessage) %}
{{ stimulus_controller('elements/collection_type', {
- 'deleteMessage': 'parameter.delete.confirm'|trans,
+ 'deleteMessage': deleteMessage|trans,
'prototype': form_widget(form.vars.prototype)|e('html_attr')
}) }}
{% endmacro %}
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf
index 185a2097..04ccc941 100644
--- a/translations/messages.en.xlf
+++ b/translations/messages.en.xlf
@@ -9351,5 +9351,11 @@ Element 3
Actions finished successfully.
+
+
+ attachment.edit.delete.confirm
+ Do you really want to delete this attachment?
+
+