← Back to team overview

yellow team mailing list archive

[Merge] lp:~gary/juju-gui/reinstatetooltips into lp:juju-gui

 

Gary Poster has proposed merging lp:~gary/juju-gui/reinstatetooltips into lp:juju-gui.

Requested reviews:
  Juju GUI Hackers (juju-gui)

For more details, see:
https://code.launchpad.net/~gary/juju-gui/reinstatetooltips/+merge/131337

Reinstate charm tooltips

The fix I made in the previous branch was incorrect.  This branch reinstates the charm configuration tooltips.
-- 
https://code.launchpad.net/~gary/juju-gui/reinstatetooltips/+merge/131337
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~gary/juju-gui/reinstatetooltips into lp:juju-gui.
=== modified file 'app/views/charm-search.js'
--- app/views/charm-search.js	2012-10-25 06:52:23 +0000
+++ app/views/charm-search.js	2012-10-25 08:26:21 +0000
@@ -197,27 +197,26 @@
               {click: function(evt) {evt.target.focus();}}
         },
         _moveTooltip: function() {
-          if (this.tooltip.get('visible')) {
-            if (Y.DOM.inRegion(
-                this.tooltip.field.getDOMNode(),
-                this.tooltip.panelRegion,
-                true)) {
-              var targetRect = this.tooltip.field.getClientRect();
-              if (targetRect) {
-                var widget = this.tooltip.get('boundingBox'),
-                    tooltipWidth = widget.get('clientWidth'),
-                    tooltipHeight = widget.get('clientHeight'),
-                    y_offset = (tooltipHeight - targetRect.height) / 2;
-                this.tooltip.move(  // These are the x, y coordinates.
-                    [this.tooltip.panel.getX() - tooltipWidth - 15,
-                     targetRect.top - y_offset]);
-                if (!this.tooltip.get('visible')) {
-                  this.tooltip.show();
-                }
+          if (this.tooltip.field &&
+              Y.DOM.inRegion(
+              this.tooltip.field.getDOMNode(),
+              this.tooltip.panelRegion,
+              true)) {
+            var targetRect = this.tooltip.field.getClientRect();
+            if (targetRect) {
+              var widget = this.tooltip.get('boundingBox'),
+                  tooltipWidth = widget.get('clientWidth'),
+                  tooltipHeight = widget.get('clientHeight'),
+                  y_offset = (tooltipHeight - targetRect.height) / 2;
+              this.tooltip.move(  // These are the x, y coordinates.
+                  [this.tooltip.panel.getX() - tooltipWidth - 15,
+                   targetRect.top - y_offset]);
+              if (!this.tooltip.get('visible')) {
+                this.tooltip.show();
               }
-            } else {
-              this.tooltip.hide();
             }
+          } else if (this.tooltip.get('visible')) {
+            this.tooltip.hide();
           }
         },
         showDescription: function(evt) {
@@ -238,6 +237,7 @@
         hideDescription: function(evt) {
           //console.log('focus', evt, evt.target.getXY());
           this.tooltip.hide();
+          delete this.tooltip.field;
         },
         onFileChange: function(evt) {
           console.log('onFileChange:', evt);


Follow ups