mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Fix tooltips instantiation for async (XHR) markup
This commit is contained in:
@@ -944,7 +944,6 @@ HTML
|
||||
$('#ac_create_{$this->iId}').dialog({ width: 'auto', height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true});
|
||||
$('#dcr_{$this->iId} form').removeAttr('onsubmit');
|
||||
$('#dcr_{$this->iId} form').on('submit.uilinksWizard', oACWidget_{$this->iId}.DoCreateObject);
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($('#ac_create_{$this->iId}'));
|
||||
JS
|
||||
);
|
||||
}
|
||||
|
||||
@@ -452,13 +452,6 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
|
||||
$this->oPage->AddUiBlock($oAttachmentTableBlock);
|
||||
|
||||
$sTableId = $oAttachmentTableBlock->GetId();
|
||||
$this->oPage->add_script(
|
||||
<<<JS
|
||||
$('#$sTableId').on('init.dt draw.dt', function(){
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($(this), true);
|
||||
});
|
||||
JS
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -473,9 +473,12 @@
|
||||
oModalElem.modal('show');
|
||||
};
|
||||
{% endblock %}
|
||||
|
||||
$(document).ready(function(){
|
||||
{% block pPageReadyScripts %}
|
||||
|
||||
$(document).ready(function ()
|
||||
{
|
||||
const oBodyElem = $('body');
|
||||
|
||||
{% block pPageReadyScripts %}
|
||||
// Add proprietary header to identify our XHR calls
|
||||
$(document).ajaxSend(function(oEvent, oXHR, oOptions) {
|
||||
oXHR.setRequestHeader('X-Combodo-Ajax', 'true');
|
||||
@@ -497,8 +500,7 @@
|
||||
if( (oData.error_message !== undefined) && (oData.error_title !== undefined) )
|
||||
{
|
||||
ShowErrorDialog(oData.error_message, oData.error_title);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
ShowErrorDialog();
|
||||
}
|
||||
@@ -507,26 +509,31 @@
|
||||
ShowErrorDialog();
|
||||
}
|
||||
});
|
||||
|
||||
// Enable tooltips based on existing HTML markup, won't work on markup added dynamically after DOM ready (AJAX, ...) ...
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips();
|
||||
// ... except for object form which are handled with the following ...
|
||||
$('body').on('form_built', function (oEvent)
|
||||
// All processing that should be done on an ajax return
|
||||
$(document).ajaxSuccess(function ()
|
||||
{
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($(oEvent.target));
|
||||
});
|
||||
// ... and BS modals which are handle with the following
|
||||
$('body').on('loaded.bs.modal', function (oEvent)
|
||||
{
|
||||
// Little timeout for stuff that need a moment to get ready but don't have a proper event.
|
||||
// Init tooltips from async. markup, small timeout to allow markup to be built if necessary
|
||||
setTimeout(function ()
|
||||
{
|
||||
//CombodoTooltip.InitAllNonInstantiatedTooltips($(oEvent.target));
|
||||
}, 500);
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips();
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// Enable tooltips based on existing HTML markup, for markup added dynamically after DOM ready (AJAX, ...) see .ajaxSuccess()...
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips();
|
||||
// ... object form which are handled with the following
|
||||
oBodyElem.on('form_built', function (oEvent)
|
||||
{
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($(oEvent.target), true);
|
||||
});
|
||||
// ... refresh of the dataTables
|
||||
oBodyElem.on('init.dt draw.dt', function (oEvent)
|
||||
{
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($(oEvent.target), true);
|
||||
});
|
||||
|
||||
// Initialize confirmation message handler when a form with touched fields is closed
|
||||
$('body').portal_leave_handler({'message': '{{ 'Portal:Form:Close:Warning'|dict_s }}'});
|
||||
oBodyElem.portal_leave_handler({'message': '{{ 'Portal:Form:Close:Warning'|dict_s }}'});
|
||||
{% endblock %}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -156,4 +156,9 @@ $(document).ready(function(){
|
||||
oTargetElem.attr('data-fullscreen-target', 'true');
|
||||
$(this).attr('data-fullscreen-toggler-instantiated', 'true');
|
||||
});
|
||||
|
||||
// Processing on datatables refresh
|
||||
$(document).on('init.dt draw.dt', function (oEvent) {
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($(oEvent.target), true);
|
||||
});
|
||||
});
|
||||
@@ -983,13 +983,6 @@ function DisplayClassDetails($oPage, $sClass, $sContext)
|
||||
|
||||
$oAttributesTable = DataTableUIBlockFactory::MakeForStaticData('', $aConfig, $aDetails, 'ibo-datamodel-viewer--attributes-table', [], "", array('pageLength' => -1));
|
||||
$oPage->AddUiBlock($oAttributesTable);
|
||||
$oPage->add_script(
|
||||
<<<JS
|
||||
$('#ibo-datamodel-viewer--attributes-table').on('init.dt draw.dt', function(){
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips($('#ibo-datamodel-viewer--attributes-table'), true);
|
||||
});
|
||||
JS
|
||||
);
|
||||
$sOrigins = json_encode(array_keys($aOrigins));
|
||||
|
||||
//color calculation in order to keep 1 color for 1 extended class. Colors are interpolated and will be used for
|
||||
|
||||
@@ -408,6 +408,12 @@ JS
|
||||
});
|
||||
}
|
||||
});
|
||||
$(document).ajaxSuccess(function(){
|
||||
// Init tooltips from async. markup, small timeout to allow markup to be built if necessary
|
||||
setTimeout(function(){
|
||||
CombodoTooltip.InitAllNonInstantiatedTooltips();
|
||||
}, 1000);
|
||||
});
|
||||
JS
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user