Part-DB.Part-DB-server/templates/components/attachments.macro.html.twig

20 lines
944 B
Twig
Raw Normal View History

{# 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 %}
<div {{ collection.controller(form, 'attachment.edit.delete.confirm') }}>
<table class="table table-striped table-sm" {{ collection.target() }}>
<tbody>
{% for attachment in form %}
{{ form_widget(attachment) }}
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" {{ collection.create_btn() }} {% if part_mode and not is_granted('attachments.create', part) %}disabled{% endif %}>
<i class="fas fa-plus-square fa-fw"></i>
{% trans %}attachment.create{% endtrans %}
</button>
</div>
{% endmacro %}