Skip to content

Commit 14635f2

Browse files
Frederick Borgestinova
Frederick Borges
authored andcommitted
B #5534: Fix Sunstone tooltips (#1669)
(cherry picked from commit 1deb13b)
1 parent f9f8935 commit 14635f2

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

src/sunstone/public/app/utils/tips.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
/* limitations under the License. */
1515
/* -------------------------------------------------------------------------- */
1616

17-
define(function(require) {
18-
// require('foundation.tooltip');
17+
define(function(require) {
1918
//Replaces all class"tip" divs with an information icon that
2019
//displays the tip information on mouseover.
2120
var _setup = function(context, position) {
@@ -31,21 +30,16 @@ define(function(require) {
3130
obj.removeClass('tip');
3231
var tip = obj.html();
3332

34-
var tip_classes = ['has-tip']
35-
if (position) {
36-
tip_classes.push(position)
37-
}
38-
//replace the text with an icon and spans
39-
//obj.html('<span data-tooltip class="' + tip_classes.join(' ') + '" data-width="210" title="' + tip + '"><i class="fas fa-question-circle"></i></span>');
40-
obj.html('<span data-tooltip aria-haspopup="true" class="has-tip" data-disable-hover="false" title="' + $.trim(tip) + '"><i class="fas fa-question-circle"></i></span>');
33+
obj.html(_html(tip));
4134
});
42-
43-
Foundation.reflow(context, 'tooltip');
4435
}
4536

46-
var _html = function(str) {
47-
//return '<span data-tooltip class="" data-width="210" title="' + str + '"><i class="fas fa-question-circle"></i></span>'
48-
return '<span data-tooltip aria-haspopup="true" class="has-tip" data-disable-hover="false" title="' + $.trim(str) + '"><i class="fas fa-question-circle"></i></span>';
37+
var _html = function(tip) {
38+
var html = '<div class="opennebula-tooltip">' +
39+
'<i class="fas fa-question-circle"></i>' +
40+
'<span class="opennebula-tooltiptext">' + $.trim(tip) + '</span>' +
41+
'</div>';
42+
return html;
4943
}
5044

5145
return {

src/sunstone/public/scss/_tooltips.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,30 @@
44

55
.fa-question-circle {
66
color: $medium-gray;
7+
}
8+
9+
/* Tooltip container */
10+
.opennebula-tooltip {
11+
position: relative;
12+
display: inline-block;
13+
}
14+
15+
/* Tooltip text */
16+
.opennebula-tooltip .opennebula-tooltiptext {
17+
visibility: hidden;
18+
width: 15em;
19+
background-color: $bold-black;
20+
color: $white;
21+
text-align: center;
22+
padding: 5px;
23+
border-radius: 6px;
24+
position: absolute;
25+
z-index: 1;
26+
font-size: $helptext-font-size;
27+
font-weight: bold;
28+
}
29+
30+
/* Show the tooltip text when you mouse over the tooltip container */
31+
.opennebula-tooltip:hover .opennebula-tooltiptext {
32+
visibility: visible;
733
}

0 commit comments

Comments
 (0)