FIX Tooltip on click was ko on smartphone

This commit is contained in:
Laurent Destailleur
2019-03-09 18:37:07 +01:00
parent 441b577599
commit fa4467fb5f
4 changed files with 44 additions and 34 deletions

View File

@@ -551,11 +551,11 @@ class Form
{
if ($type == 'info' || $type == 'help') return $text;
}
// If info or help with smartphone, show only text (tooltip on lick does not works with dialog on smaprtphone)
if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger))
{
if ($type == 'info' || $type == 'help') return $text;
}
// If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone)
//if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger))
//{
//if ($type == 'info' || $type == 'help') return '<a href="'..'">'.$text.''</a>';
//}
$img='';
if ($type == 'info') $img = img_help(0, $alt);

View File

@@ -43,22 +43,25 @@ else header('Cache-Control: no-cache');
// Wrapper to show tooltips (html or onclick popup)
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
print "jQuery(document).ready(function () {\n";
if (empty($conf->dol_no_mouse_hover))
{
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
print '
jQuery(document).ready(function () {
jQuery(".classfortooltip").tooltip({
print 'jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { delay: 50 },
tooltipClass: "mytooltip",
content: function () {
return $(this).prop(\'title\'); /* To force to get title as is */
}
});
});'."\n";
}
print '
jQuery(".classfortooltiponclicktext").dialog(
{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).',
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth']-20, 320) : 700).',
modal: true,
autoOpen: false }).css("z-index: 5000");
jQuery(".classfortooltiponclick").click(function () {
@@ -69,10 +72,10 @@ if (empty($conf->dol_no_mouse_hover))
obj.dialog("open");
return false;
}
});
});
' . "\n";
}
});'."\n";
print "});\n";
// Wrapper to manage dropdown
if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))

View File

@@ -816,7 +816,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
/**
* Function to output a dialog bog for copy/paste
* Function to output a dialog box for copy/paste
*
* @param string text Text to put into copy/paste area
* @param string text2 Text to put under the copy/paste area

View File

@@ -2132,7 +2132,14 @@ if (! GETPOST('hide_websitemenu'))
if (GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha'))
{
$htmltext=$langs->transnoentitiesnoconv("YouCanEditHtmlSource").'<br>';
if ($conf->browser->layout == 'phone')
{
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block', 1, 2, 'tooltipsubstitution');
}
else
{
print $form->textwithpicto($langs->trans("SyntaxHelp"), $htmltext, 1, 'help', 'inline-block', 1, 2, 'tooltipsubstitution');
}
}
print '</div>'; // end websitehelp