mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
collections
This commit is contained in:
@@ -11,6 +11,8 @@ class CollectionElement extends HTMLElement {
|
||||
const collectionHolder = document.querySelector('.'+e.currentTarget.dataset.collectionHolderClass);
|
||||
const item = document.createElement('div');
|
||||
|
||||
const collectionHolderList = collectionHolder.querySelector('[role="list"]');
|
||||
|
||||
item.innerHTML = collectionHolder
|
||||
.dataset
|
||||
.prototype
|
||||
@@ -19,7 +21,7 @@ class CollectionElement extends HTMLElement {
|
||||
collectionHolder.dataset.index
|
||||
);
|
||||
|
||||
collectionHolder.appendChild(item);
|
||||
collectionHolderList.appendChild(item);
|
||||
collectionHolder.dataset.index++;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@ class CollectionBlock extends AbstractTypeFormBlock
|
||||
return CollectionFormType::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AbstractFormBlock
|
||||
*/
|
||||
public function GetPrototypeBlock(): AbstractFormBlock
|
||||
{
|
||||
return $this->oPrototypeBlock;
|
||||
}
|
||||
|
||||
public function EntryDependsOnParent(string $sInputName, string $sParentInputName): AbstractFormBlock
|
||||
{
|
||||
$this->oPrototypeBlock->InputDependsOnParent($sInputName, $sParentInputName);
|
||||
|
||||
@@ -88,21 +88,21 @@
|
||||
|
||||
<collection-element {{ block('widget_container_attributes') }}>
|
||||
|
||||
{% for child in form %}
|
||||
<collection-entry-element>
|
||||
{{ form_widget(child) }}
|
||||
{% if allow_delete %}
|
||||
<button type="button" class="remove_item_link ibo-button ibo-is-regular ibo-is-danger">Supprimer</button>
|
||||
{% endif %}
|
||||
</collection-entry-element>
|
||||
{% endfor %}
|
||||
|
||||
{% if allow_add %}
|
||||
<div style="margin-top: 20px;">
|
||||
<button type="button" class="add_item_link ibo-button ibo-button ibo-is-regular " data-collection-holder-class="{{ name }}">{{ button_label|dict_s }}</button>
|
||||
</div>
|
||||
<button type="button" class="add_item_link ibo-button ibo-button ibo-is-regular " data-collection-holder-class="{{ name }}">{{ button_label|dict_s }}</button>
|
||||
{% endif %}
|
||||
|
||||
<div role="list">
|
||||
{% for child in form %}
|
||||
<collection-entry-element>
|
||||
{{ form_widget(child) }}
|
||||
{% if allow_delete %}
|
||||
<button type="button" class="remove_item_link ibo-button ibo-is-regular ibo-is-danger">Supprimer</button>
|
||||
{% endif %}
|
||||
</collection-entry-element>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</collection-element>
|
||||
|
||||
{%- endblock collection_widget -%}
|
||||
|
||||
Reference in New Issue
Block a user