allow to define templates show before and after a murph collection item
This commit is contained in:
parent
177b23365b
commit
bd663838f6
|
@ -1,5 +1,8 @@
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
* allow to define templates show before and after a murph collection item
|
||||
|
||||
### Fixed
|
||||
* fix regression on crud sorting
|
||||
* remove parameter $option on CrudConfiguration::setForm and fix CrudController make template
|
||||
|
|
|
@ -22,6 +22,8 @@ class CollectionType extends BaseCollectionType
|
|||
'label_delete' => $options['label_delete'],
|
||||
'allow_add' => $options['allow_add'],
|
||||
'allow_delete' => $options['allow_delete'],
|
||||
'template_before_item' => $options['template_before_item'],
|
||||
'template_after_item' => $options['template_after_item'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -33,6 +35,8 @@ class CollectionType extends BaseCollectionType
|
|||
'collection_name' => '',
|
||||
'label_add' => 'Add',
|
||||
'label_delete' => 'Delete',
|
||||
'template_before_item' => null,
|
||||
'template_after_item' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,10 +116,18 @@
|
|||
<div data-collection="collection-{{ collection_name }}" {% for attr, value in row_attr %}{{ attr }}="{{ value }}"{% endfor %}>
|
||||
{% for item in form %}
|
||||
<div data-collection-item="{{ loop.index }}" {% for attr, value in attrs %}{{ attr }}="{{ value }}"{% endfor %}>
|
||||
{% if template_before_item %}
|
||||
{{ include(template_before_item) }}
|
||||
{% endif %}
|
||||
|
||||
{% for child in item %}
|
||||
{{ form_row(child) }}
|
||||
{% endfor %}
|
||||
|
||||
{% if template_after_item %}
|
||||
{{ include(template_after_item) }}
|
||||
{% endif %}
|
||||
|
||||
{% if allow_delete %}
|
||||
<div class="text-right">
|
||||
<span data-collection-delete-container class="btn btn-sm btn-danger">
|
||||
|
|
Loading…
Reference in a new issue