mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°2224 - Portal: Enable tooltips for object's attributes description in dynamically added content as well (AJAX, forms, ...)
This commit is contained in:
@@ -509,9 +509,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Enable tooltips based on existing HTML markup, won't work on markup added dynamically after DOM ready (AJAX, ...)
|
||||
$('[data-tooltip-content]:not([data-tooltip-instanciated="true"])').each(function(){
|
||||
CombodoGlobalToolbox.InitTooltipFromMarkup($(this));
|
||||
// Enable tooltips based on existing HTML markup, won't work on markup added dynamically after DOM ready (AJAX, ...) ...
|
||||
CombodoGlobalToolbox.InitAllNonInstantiatedTooltips();
|
||||
// ... except for object form which are handled with the following ...
|
||||
$('body').on('form_built', function(oEvent){
|
||||
CombodoGlobalToolbox.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.
|
||||
setTimeout(function(){
|
||||
//CombodoGlobalToolbox.InitAllNonInstantiatedTooltips($(oEvent.target));
|
||||
}, 500);
|
||||
});
|
||||
|
||||
// Initialize confirmation message handler when a form with touched fields is closed
|
||||
|
||||
18
js/utils.js
18
js/utils.js
@@ -882,5 +882,23 @@ const CombodoGlobalToolbox = {
|
||||
|
||||
// Mark tooltip as instanciated
|
||||
oElem.attr('data-tooltip-instanciated', 'true');
|
||||
},
|
||||
/**
|
||||
* Instantiate all tooltips that are not already.
|
||||
* Useful after AJAX calls or dynamic content modification for examples.
|
||||
*
|
||||
* @param {Object} oContainerElem Tooltips will only be instantiated if they are contained within this jQuery object
|
||||
* @constructor
|
||||
*/
|
||||
InitAllNonInstantiatedTooltips: function(oContainerElem = null)
|
||||
{
|
||||
if(oContainerElem === null)
|
||||
{
|
||||
oContainerElem = $('body');
|
||||
}
|
||||
|
||||
oContainerElem.find('[data-tooltip-content]:not([data-tooltip-instanciated="true"])').each(function(){
|
||||
CombodoGlobalToolbox.InitTooltipFromMarkup($(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user