mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 11:24:31 +02:00
Implement attachment CollectionType using stimulus
This commit is contained in:
parent
bf3dba0fb2
commit
8323f374a4
10 changed files with 141 additions and 231 deletions
20
templates/components/attachments.macro.html.twig
Normal file
20
templates/components/attachments.macro.html.twig
Normal file
|
@ -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 %}
|
||||
<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 %}
|
|
@ -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 %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue