commit/galaxy-central: james_taylor: tooltips: use a special even to remove tooltips automatically when their element is deleted. fix the bug deleting datasets from this history.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/6d23049609a9/ changeset: 6d23049609a9 user: james_taylor date: 2012-07-25 23:08:38 summary: tooltips: use a special even to remove tooltips automatically when their element is deleted. fix the bug deleting datasets from this history. affected #: 2 files diff -r 51992bf52e0c6f1931256903f678b13ed2d373b6 -r 6d23049609a995e2ef7371aa63a7cb8bf6536403 static/scripts/bootstrap.js --- a/static/scripts/bootstrap.js +++ b/static/scripts/bootstrap.js @@ -1,3 +1,4 @@ + /* =================================================== * bootstrap-transition.js v2.0.4 * http://twitter.github.com/bootstrap/javascript.html#transitions @@ -221,6 +222,16 @@ "use strict"; // jshint ;_; + // Add a special event that is called when an element is destroyed + (function($){ + jQuery.event.special.destroyed = { + remove: function(o) { + if (o.handler) { + o.handler() + } + } + } + })(jQuery) /* TOOLTIP PUBLIC CLASS DEFINITION * =============================== */ @@ -249,6 +260,9 @@ this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) } + // Make sure tooltip is hidden when element is destroyed + this.$element.on( 'destroyed', $.proxy( this.hide, this ) ); + this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() @@ -298,6 +312,8 @@ , actualWidth , actualHeight , placement + , placementPosition + , $window , tp if (this.hasContent() && this.enabled) { @@ -312,6 +328,8 @@ this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement + placementPosition = inside ? placement.split(' ')[1] : placement; + inside = /in/.test(placement) $tip @@ -324,7 +342,7 @@ actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight - switch (inside ? placement.split(' ')[1] : placement) { + switch (placementPosition) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break @@ -339,28 +357,21 @@ break } - // BEGIN GALAXY MODIFICATION - // Shift if off screen - var $w = $(window), - p = inside ? placement.split(' ')[1] : placement; + $window = $(window) // If off the top of the screen, flip - if ( tp.top < $w.scrollTop() && placement == 'top' ) { + if ( tp.top < $window.scrollTop() && placementPosition == 'top' ) { tp.top = pos.top + pos.height; placement = inside ? 'inside bottom' : 'bottom'; } - // If off bottom, just shift for now - tp.top = Math.min( tp.top, $w.scrollTop() + $w.height() - $tip.outerHeight() ); - - // Shift left or right var leftShift = 0; - if ( tp.left < $w.scrollLeft() ) { - leftShift = tp.left - $w.scrollLeft(); + if ( tp.left < $window.scrollLeft() ) { + leftShift = tp.left - $window.scrollLeft(); } - var t = $w.scrollLeft() + $w.width() - $tip.outerWidth(); + var t = $window.scrollLeft() + $window.width() - $tip.outerWidth(); if ( tp.left > t ) { leftShift = tp.left - t; } @@ -384,7 +395,6 @@ // END GALAXY MODIFICATION - $tip .css(tp) .addClass(placement) @@ -516,4 +526,4 @@ , delay: 0 } -}(window.jQuery); \ No newline at end of file +}(window.jQuery); diff -r 51992bf52e0c6f1931256903f678b13ed2d373b6 -r 6d23049609a995e2ef7371aa63a7cb8bf6536403 templates/root/history.mako --- a/templates/root/history.mako +++ b/templates/root/history.mako @@ -138,7 +138,6 @@ } }); %endif - $(".tooltip").remove(); } else { render_message( "Dataset deletion failed", "error" ); } Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket