From 14635f2517d60ea00805446df1c54503fb8a6aff Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Tue, 14 Dec 2021 12:15:18 +0100 Subject: [PATCH] B #5534: Fix Sunstone tooltips (#1669) (cherry picked from commit 1deb13bd45850cae747459ad9fd4791dd1360f21) --- src/sunstone/public/app/utils/tips.js | 22 ++++++++------------- src/sunstone/public/scss/_tooltips.scss | 26 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/sunstone/public/app/utils/tips.js b/src/sunstone/public/app/utils/tips.js index 616db6f00ed..ce6a51f9557 100644 --- a/src/sunstone/public/app/utils/tips.js +++ b/src/sunstone/public/app/utils/tips.js @@ -14,8 +14,7 @@ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ -define(function(require) { -// require('foundation.tooltip'); +define(function(require) { //Replaces all class"tip" divs with an information icon that //displays the tip information on mouseover. var _setup = function(context, position) { @@ -31,21 +30,16 @@ define(function(require) { obj.removeClass('tip'); var tip = obj.html(); - var tip_classes = ['has-tip'] - if (position) { - tip_classes.push(position) - } - //replace the text with an icon and spans - //obj.html(''); - obj.html(''); + obj.html(_html(tip)); }); - - Foundation.reflow(context, 'tooltip'); } - var _html = function(str) { - //return '' - return ''; + var _html = function(tip) { + var html = '
' + + '' + + '' + $.trim(tip) + '' + + '
'; + return html; } return { diff --git a/src/sunstone/public/scss/_tooltips.scss b/src/sunstone/public/scss/_tooltips.scss index cbb3951c4e0..300c2566536 100644 --- a/src/sunstone/public/scss/_tooltips.scss +++ b/src/sunstone/public/scss/_tooltips.scss @@ -4,4 +4,30 @@ .fa-question-circle { color: $medium-gray; +} + +/* Tooltip container */ +.opennebula-tooltip { + position: relative; + display: inline-block; +} + +/* Tooltip text */ +.opennebula-tooltip .opennebula-tooltiptext { + visibility: hidden; + width: 15em; + background-color: $bold-black; + color: $white; + text-align: center; + padding: 5px; + border-radius: 6px; + position: absolute; + z-index: 1; + font-size: $helptext-font-size; + font-weight: bold; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.opennebula-tooltip:hover .opennebula-tooltiptext { + visibility: visible; } \ No newline at end of file