You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2012/12/06 09:09:10 UTC

[40/100] [abbrv] git commit: CS-16737: Fix tooltip alignment; allow attaching to parent element

CS-16737: Fix tooltip alignment; allow attaching to parent element

Fixes issue where tooltip overlaps form due to variable input
widths. To fix, a new option 'attachTo' can be specified, which will
attach to the closest parent element matching the option's selector.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d24f057f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d24f057f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d24f057f

Branch: refs/heads/events-framework
Commit: d24f057ff0c6262345f587131554c5aa9188d3fc
Parents: 4cb08a3
Author: Brian Federle <bf...@gmail.com>
Authored: Thu Nov 8 11:21:40 2012 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Thu Nov 8 11:29:19 2012 -0800

----------------------------------------------------------------------
 ui/scripts/ui/widgets/toolTip.js |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d24f057f/ui/scripts/ui/widgets/toolTip.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/toolTip.js b/ui/scripts/ui/widgets/toolTip.js
index 1ed2513..af6c2aa 100644
--- a/ui/scripts/ui/widgets/toolTip.js
+++ b/ui/scripts/ui/widgets/toolTip.js
@@ -22,10 +22,10 @@
       var actions = this.options.actions;
       var docID = this.options.docID;
       var text = cloudStack.docs[docID].desc;
-      var $text = $('<p>').html(text).appendTo($tooltip);
       var $tooltip = $('<div>').addClass('tooltip-box');
       var $text = $('<p>').html(text).appendTo($tooltip);
       var $container = $('#cloudStack3-container');
+
       $tooltip.appendTo($container);
 
       if (this.options.mode == 'hover'){
@@ -135,10 +135,11 @@
   function prepare(jObj, options)
   {
     var $tooltip =  $(options.tooltip);
-    var element = jObj[0];
-    var offset = jObj.offset();
+    var element = options.attachTo ?
+          jObj.closest(options.attachTo) : jObj;
+    var offset = element.offset();
 
-    var left = offset.left + jObj.width();
+    var left = offset.left + element.width();
     var top = offset.top-5;
 
     if(options.onShow){