Migliorato caricamento tooltip calendario

This commit is contained in:
loviuz 2020-01-09 19:09:49 +01:00
parent 1dbe7f54ab
commit 899c856b84
1 changed files with 27 additions and 33 deletions

View File

@ -680,45 +680,39 @@ if (Modules::getPermission('Interventi') == 'rw') {
?> ?>
eventAfterRender: function(event, element) { eventAfterRender: function(event, element) {
element.find('.fc-title').html(event.title); element.find('.fc-title').html(event.title);
element.data('idintervento', event.idintervento);
<?php <?php
if (setting('Utilizzare i tooltip sul calendario') == '1') { if (setting('Utilizzare i tooltip sul calendario') == '1') {
?> ?>
element.mouseover( function(){
if( !element.hasClass('tooltipstered') ){
$(this).data('idintervento', event.idintervento );
$.get(globals.rootdir + "/modules/dashboard/actions.php?op=get_more_info&id="+$(this).data('idintervento'), function(data,response){
if( response=="success" ){
data = $.trim(data);
if( data!="ok" ){
element.tooltipster({ element.tooltipster({
content: data, content: '<?php echo tr('Caricamento...'); ?>',
animation: 'grow', animation: 'grow',
contentAsHTML: true, contentAsHTML: true,
hideOnClick: true, hideOnClick: true,
onlyOne: true,
speed: 200, speed: 200,
delay: 100, delay: 300,
maxWidth: 400, maxWidth: 400,
theme: 'tooltipster-shadow', theme: 'tooltipster-shadow',
touchDevices: true, touchDevices: true,
trigger: 'hover', trigger: 'hover',
position: 'left' position: 'left',
}); functionBefore: function(instance, helper) {
var $origin = $(helper.origin);
$('.tooltipstered').tooltipster('hide'); // we set a variable so the data is only loaded once via Ajax, not every time the tooltip opens
element.tooltipster('show'); if ($origin.data('loaded') !== true) {
}
else{
return false;
}
$('#calendar').fullCalendar('option', 'contentHeight', 'auto'); $.get(globals.rootdir + "/modules/dashboard/actions.php?op=get_more_info&id="+event.idintervento, function(data) {
}
// call the 'content' method to update the content of our tooltip with the returned data.
// note: this content update will trigger an update animation (see the updateAnimation option)
instance.content(data);
// to remember that the data has been loaded
$origin.data('loaded', true);
}); });
} }
}
}); });
<?php <?php
} }