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