mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Do not render script methods when no script present, adcd0eb9 followup
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
{# @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')) %}
|
{% set sId = oLayout.GetId() | sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME')) %}
|
||||||
|
{% set bHasOnInitOrOnDomReadyScripts = aPage.aJsInlineOnInit is not empty or aPage.aJsInlineOnDomReady is not empty %}
|
||||||
{% if bEscapeContent %}
|
{% if bEscapeContent %}
|
||||||
{{ render_block(oLayout, {aPage: aPage})|escape }}
|
{{ render_block(oLayout, {aPage: aPage})|escape }}
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -25,19 +26,21 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
let fOnJsFilesLoaded{{ sId }} = function (fResolve) {
|
|
||||||
{% for sJsInline in aPage.aJsInlineOnInit %}
|
|
||||||
{{ sJsInline|raw }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for sJsInline in aPage.aJsInlineOnDomReady %}
|
{% if bHasOnInitOrOnDomReadyScripts %}
|
||||||
{{ sJsInline|raw }}
|
<script type="text/javascript">
|
||||||
{% endfor %}
|
let fOnJsFilesLoaded{{ sId }} = function (fResolve) {
|
||||||
fResolve();
|
{% for sJsInline in aPage.aJsInlineOnInit %}
|
||||||
}
|
{{ sJsInline|raw }}
|
||||||
</script>
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for sJsInline in aPage.aJsInlineOnDomReady %}
|
||||||
|
{{ sJsInline|raw }}
|
||||||
|
{% endfor %}
|
||||||
|
fResolve();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% set sPromiseId = aPage.sPromiseId %}
|
{% set sPromiseId = aPage.sPromiseId %}
|
||||||
{% if aPage.aJsFiles is not empty %}
|
{% if aPage.aJsFiles is not empty %}
|
||||||
@@ -132,13 +135,15 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% block iboPageJsInlineOnDomReady %}
|
{% if bHasOnInitOrOnDomReadyScripts %}
|
||||||
<script type="text/javascript">
|
{% block iboPageJsInlineOnDomReady %}
|
||||||
window['{{ sPromiseId }}'] = new Promise(function (fNoJsFileResolve, fNoJsFileReject) {
|
<script type="text/javascript">
|
||||||
fOnJsFilesLoaded{{ sId }}(fNoJsFileResolve);
|
window['{{ sPromiseId }}'] = new Promise(function (fNoJsFileResolve, fNoJsFileReject) {
|
||||||
});
|
fOnJsFilesLoaded{{ sId }}(fNoJsFileResolve);
|
||||||
</script>
|
});
|
||||||
{% endblock %}
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if aDeferredBlocks is not empty %}
|
{% if aDeferredBlocks is not empty %}
|
||||||
|
|||||||
Reference in New Issue
Block a user