Fix can use tooltip with popup even for column titles

This commit is contained in:
Laurent Destailleur
2017-11-09 18:50:15 +01:00
parent f6a0603fb0
commit 9d3cf8f217
4 changed files with 7 additions and 7 deletions

View File

@@ -276,7 +276,7 @@ if ($mode != 'focus')
{ {
$texthelp.=$key.' -> '.$val.'<br>'; $texthelp.=$key.' -> '.$val.'<br>';
} }
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
} }
else else
{ {

View File

@@ -708,7 +708,7 @@ if ($resql)
{ {
if (! empty($tabhelp[$id][$value])) if (! empty($tabhelp[$id][$value]))
{ {
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on hover
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
} }
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);

View File

@@ -534,7 +534,7 @@ class Form
elseif ($type == 'warning') $img = img_warning($alt); elseif ($type == 'warning') $img = img_warning($alt);
else $img = img_picto($alt, $type); else $img = img_picto($alt, $type);
return $this->textwithtooltip($text, $htmltext, ($tooltiptrigger?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger); return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && ! $img)?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger);
} }
/** /**

View File

@@ -65,7 +65,7 @@ if (empty($conf->dol_no_mouse_hover))
{ {
obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */ obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */
obj.dialog("open"); obj.dialog("open");
return false;
} }
}); });
}); });
@@ -79,15 +79,14 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
print ' print '
jQuery(document).ready(function () { jQuery(document).ready(function () {
$(".dropdown dt a").on(\'click\', function () { $(".dropdown dt a").on(\'click\', function () {
console.log("We click on dropdown");
//console.log($(this).parent().parent().find(\'dd ul\')); //console.log($(this).parent().parent().find(\'dd ul\'));
$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\'); $(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
// Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines // Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines
heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length; heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length;
if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul
posbottom = $(this).parent().parent().find(\'dd\').offset().top + heigthofcontent + 8; posbottom = $(this).parent().parent().find(\'dd\').offset().top + heigthofcontent + 8;
//console.log(posbottom);
var scrollBottom = $(window).scrollTop() + $(window).height(); var scrollBottom = $(window).scrollTop() + $(window).height();
//console.log(scrollBottom);
diffoutsidebottom = (posbottom - scrollBottom); diffoutsidebottom = (posbottom - scrollBottom);
console.log("heigthofcontent="+heigthofcontent+", diffoutsidebottom (posbottom="+posbottom+" - scrollBottom="+scrollBottom+") = "+diffoutsidebottom); console.log("heigthofcontent="+heigthofcontent+", diffoutsidebottom (posbottom="+posbottom+" - scrollBottom="+scrollBottom+") = "+diffoutsidebottom);
if (diffoutsidebottom > 0) if (diffoutsidebottom > 0)
@@ -104,6 +103,7 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
}); });
$(document).bind(\'click\', function (e) { $(document).bind(\'click\', function (e) {
// TODO Use a bind on elements in dropdown only to avoid to bind/code all clicks
var $clicked = $(e.target); var $clicked = $(e.target);
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
}); });
@@ -135,7 +135,7 @@ print '
jQuery(".reposition").click(function() { jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop(); var page_y = $(document).scrollTop();
this.href=this.href+\'&page_y=\'+page_y; this.href=this.href+\'&page_y=\'+page_y;
console.log("this.ref is now "+this.href) console.log("We click on tag with .reposition class. this.ref is now "+this.href)
}); });
});'."\n"; });'."\n";