mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
N°8772 - Turbo + Collections WIP
This commit is contained in:
@@ -3,12 +3,28 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function triggerTurbo(el) {
|
||||
let sFormName = el.form.getAttribute("name");
|
||||
el.form.querySelector(`[name="${sFormName}[_turbo_trigger]"]`).value = el.getAttribute('name');
|
||||
el.form.setAttribute('novalidate', true);
|
||||
el.form.requestSubmit();
|
||||
console.log('Auto submitting form due to change in field ' + el.getAttribute('name'));
|
||||
}
|
||||
|
||||
function addFormToCollection(e) {
|
||||
const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass);
|
||||
const item = document.createElement('div');
|
||||
|
||||
item.style.marginTop = '20px';
|
||||
item.innerHTML = collectionHolder
|
||||
.dataset
|
||||
.prototype
|
||||
.replace(
|
||||
/__name__/g,
|
||||
collectionHolder.dataset.index
|
||||
);
|
||||
|
||||
collectionHolder.appendChild(item);
|
||||
collectionHolder.dataset.index++;
|
||||
console.log(collectionHolder.dataset.index);
|
||||
}
|
||||
@@ -31,7 +31,6 @@ class FormType extends AbstractType
|
||||
'name' => $oChild->GetName(),
|
||||
'added' => $oChild->IsAdded(),
|
||||
'id' => $oChild->GetIdentifier(),
|
||||
'path' => $oFormChild->getPropertyPath(),
|
||||
];
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
{%- block form_rows -%}
|
||||
|
||||
{% for block in blocks %}
|
||||
<div id="block_{{ block.id }}" class="ibo-field ibo-content-block ibo-block ibo-field-small">
|
||||
<div id="turbo_{{ block.id }}" class="ibo-field ibo-content-block ibo-block ibo-field-small">
|
||||
{% if block.added == 1 %}
|
||||
{{ form_row(form[block.name]) }}
|
||||
{% else %}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
||||
|
||||
{% for sBlockIdentifier, oBlockToRedraw in blocks_to_redraw %}
|
||||
{% UITurboUpdate Standard { sTarget: "block_" ~ sBlockIdentifier} %}
|
||||
{% UITurboUpdate Standard { sTarget: "turbo_" ~ sBlockIdentifier} %}
|
||||
{% if oBlockToRedraw is not null %}
|
||||
{{ form_row(oBlockToRedraw) }}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user