mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 23:32: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 %}
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% if bHasOnInitOrOnDomReadyScripts %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
let fOnJsFilesLoaded{{ sId }} = function (fResolve) {
|
let fOnJsFilesLoaded{{ sId }} = function (fResolve) {
|
||||||
{% for sJsInline in aPage.aJsInlineOnInit %}
|
{% for sJsInline in aPage.aJsInlineOnInit %}
|
||||||
@@ -38,6 +40,7 @@
|
|||||||
fResolve();
|
fResolve();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% set sPromiseId = aPage.sPromiseId %}
|
{% set sPromiseId = aPage.sPromiseId %}
|
||||||
{% if aPage.aJsFiles is not empty %}
|
{% if aPage.aJsFiles is not empty %}
|
||||||
@@ -132,6 +135,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% if bHasOnInitOrOnDomReadyScripts %}
|
||||||
{% block iboPageJsInlineOnDomReady %}
|
{% block iboPageJsInlineOnDomReady %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window['{{ sPromiseId }}'] = new Promise(function (fNoJsFileResolve, fNoJsFileReject) {
|
window['{{ sPromiseId }}'] = new Promise(function (fNoJsFileResolve, fNoJsFileReject) {
|
||||||
@@ -140,6 +144,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if aDeferredBlocks is not empty %}
|
{% if aDeferredBlocks is not empty %}
|
||||||
{% for oBlock in aDeferredBlocks %}
|
{% for oBlock in aDeferredBlocks %}
|
||||||
|
|||||||
Reference in New Issue
Block a user