Files
iTop/templates/components/button/layout.js.twig
2020-08-14 16:26:16 +02:00

15 lines
560 B
Twig

// TODO: We need to find a clean way to launch this script only once the JS scripts are loaded
{% if (oUIBlock.GetOnClickJsCode() is not empty) or (oUIBlock.GetJsCode() is not empty) %}
document.addEventListener("DOMContentLoaded", function(){
setTimeout(function(){
{% if oUIBlock.GetOnClickJsCode() is not empty %}
$('#{{ oUIBlock.GetId() }}').on('click', function(){
{{ oUIBlock.GetOnClickJsCode() }}
})
{% endif %}
{% if oUIBlock.GetJsCode() is not empty %}
{{ oUIBlock.GetJsCode() }}
{% endif %}
}, 500);
});
{% endif %}