mirror of
https://github.com/Combodo/iTop.git
synced 2026-09-15 10:38:20 +02:00
Fix some js scripts being loaded before their dependencies in ajax calls
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{# @copyright Copyright (C) 2010-2023 Combodo SARL #}
|
{# @copyright Copyright (C) 2010-2023 Combodo SARL #}
|
||||||
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
||||||
{% apply spaceless %}
|
{% apply spaceless %}
|
||||||
|
{% set sId = oLayout.GetId() | sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME')) %}
|
||||||
{% if bEscapeContent %}
|
{% if bEscapeContent %}
|
||||||
{{ render_block(oLayout, {aPage: aPage})|escape }}
|
{{ render_block(oLayout, {aPage: aPage})|escape }}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -16,33 +17,33 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block iboPageJsInlineLive %}
|
{% block iboPageJsInlineLive %}
|
||||||
{% for sJsInline in aPage.aJsInlineLive %}
|
{% for sJsInline in aPage.aJsInlineLive %}
|
||||||
{# We put each scripts in a dedicated script tag to prevent massive failure if 1 script is broken (eg. missing semi-colon or non closed multi-line comment) #}
|
{# We put each scripts in a dedicated script tag to prevent massive failure if 1 script is broken (eg. missing semi-colon or non closed multi-line comment) #}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{{ sJsInline|raw }}
|
{{ sJsInline|raw }}
|
||||||
</script>
|
</script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for sJsInline in aPage.aJsInlineOnInit %}
|
{% endblock %}
|
||||||
<script type="text/javascript">
|
|
||||||
{{ sJsInline|raw }}
|
<script type="text/javascript">
|
||||||
</script>
|
let fOnJsFilesLoaded{{ sId }} = function (fResolve) {
|
||||||
{% endfor %}
|
{% for sJsInline in aPage.aJsInlineOnInit %}
|
||||||
{% endblock %}
|
{{ sJsInline|raw }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for sJsInline in aPage.aJsInlineOnDomReady %}
|
||||||
|
{{ sJsInline|raw }}
|
||||||
|
{% endfor %}
|
||||||
|
fResolve();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
{% set sPromiseId = aPage.sPromiseId %}
|
{% set sPromiseId = aPage.sPromiseId %}
|
||||||
{% if aPage.aJsFiles is not empty %}
|
{% if aPage.aJsFiles is not empty %}
|
||||||
{% set sId = oLayout.GetId() | sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME')) %}
|
|
||||||
{% block iboPageJsFiles %}
|
{% block iboPageJsFiles %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window['{{ sPromiseId }}'] = new Promise(function (resolve, reject) {
|
window['{{ sPromiseId }}'] = new Promise(function (fAllJsFilesResolve, fAllJsFilesReject) {
|
||||||
let fInlineOnDomReadyScript{{ sId }} = function () {
|
|
||||||
{% for sJsInlineOnDomReady in aPage.aJsInlineOnDomReady %}
|
|
||||||
{{ sJsInlineOnDomReady|raw }}
|
|
||||||
{% endfor %}
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array} aJsFilesToLoad Files required by the current \AjaxPage
|
* @type {Array} aJsFilesToLoad Files required by the current \AjaxPage
|
||||||
*
|
*
|
||||||
@@ -117,7 +118,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fInlineOnDomReadyScript{{ sId }}();
|
fOnJsFilesLoaded{{ sId }}(fAllJsFilesResolve);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -125,21 +126,18 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fInlineOnDomReadyScript{{ sId }}();
|
fOnJsFilesLoaded{{ sId }}(fAllJsFilesResolve);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% block iboPageJsInlineOnDomReady %}
|
{% block iboPageJsInlineOnDomReady %}
|
||||||
{% for sJsInlineOnDomReady in aPage.aJsInlineOnDomReady %}
|
<script type="text/javascript">
|
||||||
<script type="text/javascript">
|
window['{{ sPromiseId }}'] = new Promise(function (fNoJsFileResolve, fNoJsFileReject) {
|
||||||
window['{{ sPromiseId }}'] = new Promise(function (resolve, reject) {
|
fOnJsFilesLoaded{{ sId }}(fNoJsFileResolve);
|
||||||
{{ sJsInlineOnDomReady|raw }}
|
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user