From 062e96cc07a1e1ebe76e3bc3de0f788c448bae09 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Tue, 3 Dec 2013 15:43:17 +0530 Subject: [PATCH 01/28] [IMP]Add bootstrap tooltip. bzr revid: bth@tinyerp.com-20131203101317-bznca04cdosg0x3z --- addons/web/__openerp__.py | 1 + addons/web/static/lib/bootstrap/js/tooltip.js | 385 ++++++++++++++++++ addons/web/static/src/js/chrome.js | 7 +- addons/web/static/src/js/view_form.js | 18 +- addons/web/static/src/js/views.js | 4 +- addons/web_kanban/static/src/js/kanban.js | 8 +- .../static/src/js/kanban_sparkline.js | 2 +- 7 files changed, 407 insertions(+), 18 deletions(-) create mode 100644 addons/web/static/lib/bootstrap/js/tooltip.js diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index 9ea84a3501f..7cc78212bd8 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -43,6 +43,7 @@ This module provides the core of the OpenERP Web Client. "static/lib/cleditor/jquery.cleditor.js", "static/lib/py.js/lib/py.js", "static/src/js/openerpframework.js", + "static/lib/bootstrap/js/tooltip.js", "static/src/js/boot.js", "static/src/js/testing.js", "static/src/js/pyeval.js", diff --git a/addons/web/static/lib/bootstrap/js/tooltip.js b/addons/web/static/lib/bootstrap/js/tooltip.js new file mode 100644 index 00000000000..46b8c9bdd85 --- /dev/null +++ b/addons/web/static/lib/bootstrap/js/tooltip.js @@ -0,0 +1,385 @@ +/* ======================================================================== + * Bootstrap: tooltip.js v3.0.2 + * http://getbootstrap.com/javascript/#tooltip + * Inspired by the original jQuery.tipsy by Jason Frame + * ======================================================================== + * Copyright 2013 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== */ + + ++function ($) { "use strict"; + + // TOOLTIP PUBLIC CLASS DEFINITION + // =============================== + + var Tooltip = function (element, options) { + this.type = + this.options = + this.enabled = + this.timeout = + this.hoverState = + this.$element = null + + this.init('tooltip', element, options) + } + + Tooltip.DEFAULTS = { + animation: true + , placement: 'top' + , selector: false + , template: '
' + , trigger: 'hover focus' + , title: '' + , delay: 0 + , html: false + , container: false + } + + Tooltip.prototype.init = function (type, element, options) { + this.enabled = true + this.type = type + this.$element = $(element) + this.options = this.getOptions(options) + + var triggers = this.options.trigger.split(' ') + + for (var i = triggers.length; i--;) { + var trigger = triggers[i] + + if (trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (trigger != 'manual') { + var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' + var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' + + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + } + } + + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } + + Tooltip.prototype.getDefaults = function () { + return Tooltip.DEFAULTS + } + + Tooltip.prototype.getOptions = function (options) { + options = $.extend({}, this.getDefaults(), this.$element.data(), options) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay + , hide: options.delay + } + } + + return options + } + + Tooltip.prototype.getDelegateOptions = function () { + var options = {} + var defaults = this.getDefaults() + + this._options && $.each(this._options, function (key, value) { + if (defaults[key] != value) options[key] = value + }) + + return options + } + + Tooltip.prototype.enter = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) + + clearTimeout(self.timeout) + + self.hoverState = 'in' + + if (!self.options.delay || !self.options.delay.show) return self.show() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } + + Tooltip.prototype.leave = function (obj) { + var self = obj instanceof this.constructor ? + obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) + + clearTimeout(self.timeout) + + self.hoverState = 'out' + + if (!self.options.delay || !self.options.delay.hide) return self.hide() + + self.timeout = setTimeout(function () { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } + + Tooltip.prototype.show = function () { + var e = $.Event('show.bs.'+ this.type) + + if (this.hasContent() && this.enabled) { + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + var $tip = this.tip() + + this.setContent() + + if (this.options.animation) $tip.addClass('fade') + + var placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + var autoToken = /\s?auto?\s?/i + var autoPlace = autoToken.test(placement) + if (autoPlace) placement = placement.replace(autoToken, '') || 'top' + + $tip + .detach() + .css({ top: 0, left: 0, display: 'block' }) + .addClass(placement) + + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + + var pos = this.getPosition() + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + if (autoPlace) { + var $parent = this.$element.parent() + + var orgPlacement = placement + var docScroll = document.documentElement.scrollTop || document.body.scrollTop + var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth() + var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight() + var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left + + placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : + placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' : + placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' : + placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' : + placement + + $tip + .removeClass(orgPlacement) + .addClass(placement) + } + + var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) + + this.applyPlacement(calculatedOffset, placement) + this.$element.trigger('shown.bs.' + this.type) + } + } + + Tooltip.prototype.applyPlacement = function(offset, placement) { + var replace + var $tip = this.tip() + var width = $tip[0].offsetWidth + var height = $tip[0].offsetHeight + + // manually read margins because getBoundingClientRect includes difference + var marginTop = parseInt($tip.css('margin-top'), 10) + var marginLeft = parseInt($tip.css('margin-left'), 10) + + // we must check for NaN for ie 8/9 + if (isNaN(marginTop)) marginTop = 0 + if (isNaN(marginLeft)) marginLeft = 0 + + offset.top = offset.top + marginTop + offset.left = offset.left + marginLeft + + $tip + .offset(offset) + .addClass('in') + + // check to see if placing tip in new offset caused the tip to resize itself + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + if (placement == 'top' && actualHeight != height) { + replace = true + offset.top = offset.top + height - actualHeight + } + + if (/bottom|top/.test(placement)) { + var delta = 0 + + if (offset.left < 0) { + delta = offset.left * -2 + offset.left = 0 + + $tip.offset(offset) + + actualWidth = $tip[0].offsetWidth + actualHeight = $tip[0].offsetHeight + } + + this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') + } else { + this.replaceArrow(actualHeight - height, actualHeight, 'top') + } + + if (replace) $tip.offset(offset) + } + + Tooltip.prototype.replaceArrow = function(delta, dimension, position) { + this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') + } + + Tooltip.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } + + Tooltip.prototype.hide = function () { + var that = this + var $tip = this.tip() + var e = $.Event('hide.bs.' + this.type) + + function complete() { + if (that.hoverState != 'in') $tip.detach() + } + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + $tip.removeClass('in') + + $.support.transition && this.$tip.hasClass('fade') ? + $tip + .one($.support.transition.end, complete) + .emulateTransitionEnd(150) : + complete() + + this.$element.trigger('hidden.bs.' + this.type) + + return this + } + + Tooltip.prototype.fixTitle = function () { + var $e = this.$element + if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') + } + } + + Tooltip.prototype.hasContent = function () { + return this.getTitle() + } + + Tooltip.prototype.getPosition = function () { + var el = this.$element[0] + return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { + width: el.offsetWidth + , height: el.offsetHeight + }, this.$element.offset()) + } + + Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { + return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : + /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + } + + Tooltip.prototype.getTitle = function () { + var title + var $e = this.$element + var o = this.options + + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + + return title + } + + Tooltip.prototype.tip = function () { + return this.$tip = this.$tip || $(this.options.template) + } + + Tooltip.prototype.arrow = function () { + return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') + } + + Tooltip.prototype.validate = function () { + if (!this.$element[0].parentNode) { + this.hide() + this.$element = null + this.options = null + } + } + + Tooltip.prototype.enable = function () { + this.enabled = true + } + + Tooltip.prototype.disable = function () { + this.enabled = false + } + + Tooltip.prototype.toggleEnabled = function () { + this.enabled = !this.enabled + } + + Tooltip.prototype.toggle = function (e) { + var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this + self.tip().hasClass('in') ? self.leave(self) : self.enter(self) + } + + Tooltip.prototype.destroy = function () { + this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) + } + + + // TOOLTIP PLUGIN DEFINITION + // ========================= + + var old = $.fn.tooltip + + $.fn.tooltip = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tooltip') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.tooltip.Constructor = Tooltip + + + // TOOLTIP NO CONFLICT + // =================== + + $.fn.tooltip.noConflict = function () { + $.fn.tooltip = old + return this + } + +}(jQuery); diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index abbd4767361..c58089f4b5c 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1261,8 +1261,8 @@ instance.web.Client = instance.web.Widget.extend({ }, bind_events: function() { var self = this; - this.$el.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { - $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter'); + this.$el.on('mouseenter', '.oe_systray > div:not([data-toggle=tooltip])', function() { + $(this).attr('data-toggle', 'tooltip').tooltip().trigger('mouseenter'); }); this.$el.on('click', '.oe_dropdown_toggle', function(ev) { ev.preventDefault(); @@ -1286,7 +1286,8 @@ instance.web.Client = instance.web.Widget.extend({ }, 0); }); instance.web.bus.on('click', this, function(ev) { - $.fn.tipsy.clear(); + $.fn.tooltip('destroy'); + this.$el.find('.oe_systray').find('div') if (!$(ev.target).is('input[type=file]')) { self.$el.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 683cdebbbf4..748f9bde4f8 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1819,7 +1819,7 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi this.$el.addClass(this.node.attrs["class"] || ""); }, destroy: function() { - $.fn.tipsy.clear(); + $.fn.tooltip('destroy'); this._super.apply(this, arguments); }, /** @@ -1851,9 +1851,9 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget = widget || this; trigger = trigger || this.$el; options = _.extend({ - delayIn: 500, - delayOut: 0, - fade: true, + //delayIn: 500, + //delayOut: 0, + //fade: true, title: function() { var template = widget.template + '.tooltip'; if (!QWeb.has_template(template)) { @@ -1864,12 +1864,14 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget: widget }); }, - gravity: $.fn.tipsy.autoBounds(50, 'nw'), + //gravity: $.fn.tooltip.autoBounds(50, 'nw'), + placement: 'right', html: true, - opacity: 0.85, - trigger: 'hover' + //opacity: 0.85, + //trigger: 'hover' }, options || {}); - $(trigger).tipsy(options); + $(trigger).attr('data-toggle', 'tooltip'); + $(trigger).tooltip(options); }, /** * Builds a new context usable for operations related to fields by merging diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 37369377bf1..80e72a5d813 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -585,7 +585,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ var self = this; this.$el.find('.oe_view_manager_switch a').click(function() { self.switch_mode($(this).data('view-type')); - }).tipsy(); + }).tooltip(); var views_ids = {}; _.each(this.views_src, function(view) { self.views[view.view_type] = $.extend({}, view, { @@ -1152,7 +1152,7 @@ instance.web.Sidebar = instance.web.Widget.extend({ $(this).toggle(!!$(this).find('li').length); }); - self.$("[title]").tipsy({ + self.$("[title]").tooltip({ 'html': true, 'delayIn': 500, }); diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 7d25d647f8b..5275baaa5e8 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -423,7 +423,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; - $.fn.tipsy.clear(); + $.fn.tooltip('destroy'); $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); if (old_group === new_group) { new_group.records.splice(old_index, 1); @@ -626,7 +626,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ this.$records.data('widget', this); this.$has_been_started.resolve(); var add_btn = this.$el.find('.oe_kanban_add'); - add_btn.tipsy({delayIn: 500, delayOut: 1000}); + add_btn.tooltip({delayIn: 500, delayOut: 1000}); this.$records.find(".oe_kanban_column_cards").click(function (ev) { if (ev.target == ev.currentTarget) { if (!self.state.folded) { @@ -666,7 +666,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by]) .filter([["id", "=", this.value]]).first().then(function(res) { self.tooltip = res[options.tooltip_on_group_by]; - self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tipsy({html: true}); + self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true}); }); } }, @@ -894,7 +894,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ bind_events: function() { var self = this; this.setup_color_picker(); - this.$el.find('[tooltip]').tipsy({ + this.$el.find('[tooltip]').tooltip({ delayIn: 500, delayOut: 0, fade: true, diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index 5335599478f..bb1d5627ef0 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -27,7 +27,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.tipsy({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'}); + self.$el.tooltip({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'}); }, 0); }, }); From 165d289384a40e08a475385a4d0ea0edbf1bca23 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Tue, 3 Dec 2013 18:21:13 +0530 Subject: [PATCH 02/28] [IMP]Removed tipsy library and add placement in tooltip. bzr revid: bth@tinyerp.com-20131203125113-fuapp6wpvmcif1c5 --- addons/web/__openerp__.py | 2 -- addons/web/static/src/js/views.js | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index 7cc78212bd8..df14cf76e74 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -33,7 +33,6 @@ This module provides the core of the OpenERP Web Client. "static/lib/jquery.ui.notify/js/jquery.notify.js", "static/lib/jquery.deferred-queue/jquery.deferred-queue.js", "static/lib/jquery.scrollTo/jquery.scrollTo-min.js", - "static/lib/jquery.tipsy/jquery.tipsy.js", "static/lib/jquery.textext/jquery.textext.js", "static/lib/jquery.timeago/jquery.timeago.js", "static/lib/qweb/qweb2.js", @@ -63,7 +62,6 @@ This module provides the core of the OpenERP Web Client. "static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css", "static/lib/jquery.ui.timepicker/css/jquery-ui-timepicker-addon.css", "static/lib/jquery.ui.notify/css/ui.notify.css", - "static/lib/jquery.tipsy/tipsy.css", "static/lib/jquery.textext/jquery.textext.css", "static/lib/fontawesome/css/font-awesome.css", "static/lib/bootstrap/css/bootstrap.css", diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 80e72a5d813..01b469d39d1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -583,9 +583,10 @@ instance.web.ViewManager = instance.web.Widget.extend({ start: function() { this._super(); var self = this; + this.$el.find('.oe_view_manager_switch a').attr('data-toggle', 'tooltip'); this.$el.find('.oe_view_manager_switch a').click(function() { self.switch_mode($(this).data('view-type')); - }).tooltip(); + }).tooltip({'placement': 'bottom'}); var views_ids = {}; _.each(this.views_src, function(view) { self.views[view.view_type] = $.extend({}, view, { From 5d874a4acb1e2e60069d879bef4d49226492b4cd Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Wed, 4 Dec 2013 17:28:24 +0530 Subject: [PATCH 03/28] [IMP]Improved css and offset for tooltip. bzr revid: bth@tinyerp.com-20131204115824-tbq4nys4c0d2c327 --- addons/web/static/lib/bootstrap/js/tooltip.js | 3 ++- addons/web/static/src/css/base.css | 7 +++++++ addons/web/static/src/js/view_form.js | 10 +++------- addons/web/static/src/js/views.js | 6 +++++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/addons/web/static/lib/bootstrap/js/tooltip.js b/addons/web/static/lib/bootstrap/js/tooltip.js index 46b8c9bdd85..5bc53a2d7cc 100644 --- a/addons/web/static/lib/bootstrap/js/tooltip.js +++ b/addons/web/static/lib/bootstrap/js/tooltip.js @@ -159,6 +159,7 @@ .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) + $tip.openerpClass('oe_tooltip') this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) var pos = this.getPosition() @@ -300,7 +301,7 @@ } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + return placement == 'bottom' ? { top: pos.top + pos.height, left: (pos.left + pos.width / 2 - actualWidth / 2) + actualWidth/3} : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 010585ee4a0..96fbcf9f805 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -601,6 +601,7 @@ } .openerp.oe_tooltip { font-size: 12px; + background-color: transparent; } .openerp.oe_tooltip .oe_tooltip_string { color: #ffdd55; @@ -633,6 +634,12 @@ .openerp.oe_tooltip .oe_tooltip_message { max-width: 310px; } +.tooltip-inner { + text-align: left !important; +} +.tooltip.bottom .tooltip-arrow { + left: 12% !important; +} .openerp .oe_notebook { margin: 8px 0; padding: 0 16px; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 748f9bde4f8..ed6d66e5c68 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1851,9 +1851,6 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget = widget || this; trigger = trigger || this.$el; options = _.extend({ - //delayIn: 500, - //delayOut: 0, - //fade: true, title: function() { var template = widget.template + '.tooltip'; if (!QWeb.has_template(template)) { @@ -1864,11 +1861,10 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget: widget }); }, - //gravity: $.fn.tooltip.autoBounds(50, 'nw'), - placement: 'right', + container: 'body', + placement: 'bottom', html: true, - //opacity: 0.85, - //trigger: 'hover' + opacity: 0.85, }, options || {}); $(trigger).attr('data-toggle', 'tooltip'); $(trigger).tooltip(options); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 01b469d39d1..f9e8018b183 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -586,7 +586,11 @@ instance.web.ViewManager = instance.web.Widget.extend({ this.$el.find('.oe_view_manager_switch a').attr('data-toggle', 'tooltip'); this.$el.find('.oe_view_manager_switch a').click(function() { self.switch_mode($(this).data('view-type')); - }).tooltip({'placement': 'bottom'}); + }).tooltip({ + container: 'body', + html: true, + opacity: 0.85 + }); var views_ids = {}; _.each(this.views_src, function(view) { self.views[view.view_type] = $.extend({}, view, { From f33076bcd8aba7a513636d45314c0ece3ff5614f Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Wed, 4 Dec 2013 17:52:37 +0530 Subject: [PATCH 04/28] [IMP]Set margin-top. bzr revid: bth@tinyerp.com-20131204122237-lsymfmuoiyg5z371 --- addons/web/static/src/css/base.css | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 96fbcf9f805..b4e6d4a24b2 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -639,6 +639,7 @@ } .tooltip.bottom .tooltip-arrow { left: 12% !important; + margin-top: 0.5px; } .openerp .oe_notebook { margin: 8px 0; From ec460514911d6f6af386437f8a2241860b11f2b9 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Wed, 4 Dec 2013 19:01:11 +0530 Subject: [PATCH 05/28] [IMP]Tooltip options set for kanban. bzr revid: bth@tinyerp.com-20131204133111-phpla4u9ggsu2rlh --- addons/web_kanban/static/src/js/kanban.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 5275baaa5e8..962ad87a2b4 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -666,7 +666,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by]) .filter([["id", "=", this.value]]).first().then(function(res) { self.tooltip = res[options.tooltip_on_group_by]; - self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true}); + self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true, placement: 'bottom'}); }); } }, @@ -895,9 +895,6 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ var self = this; this.setup_color_picker(); this.$el.find('[tooltip]').tooltip({ - delayIn: 500, - delayOut: 0, - fade: true, title: function() { var template = $(this).attr('tooltip'); if (!self.view.qweb.has_template(template)) { @@ -905,10 +902,9 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ } return self.view.qweb.render(template, self.qweb_context); }, - gravity: 's', + placement: 'bottom', html: true, opacity: 0.8, - trigger: 'hover' }); // If no draghandle is found, make the whole card as draghandle (provided one can edit) From 63cd96ac8e49a7cc997ba61d37ee8461a2a42b64 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Wed, 4 Dec 2013 19:04:27 +0530 Subject: [PATCH 06/28] [IMP]Set tooltip options for sparkline. bzr revid: bth@tinyerp.com-20131204133427-soik5m01v6p59al1 --- addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index bb1d5627ef0..df2ae6cd4bc 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -27,7 +27,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.tooltip({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'}); + self.$el.tooltip({'html': true, 'title': function(){return title}, 'placement': 'bottom'}); }, 0); }, }); From 3fd24e1cb5f67fa3c42476b9a6e6e5589ca21e3b Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 11:50:07 +0530 Subject: [PATCH 07/28] [IMP]Add tooltip options and add for search view drawer. bzr revid: bth@tinyerp.com-20131205062007-cbo6wuuyg1buy0we --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/js/chrome.js | 2 +- addons/web/static/src/js/search.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b4e6d4a24b2..6188b3fc26e 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -641,6 +641,9 @@ left: 12% !important; margin-top: 0.5px; } +.tooltip.bottom { + padding: 5px 0 !important; +} .openerp .oe_notebook { margin: 8px 0; padding: 0 16px; diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index c58089f4b5c..848f9e1ec3c 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1262,7 +1262,7 @@ instance.web.Client = instance.web.Widget.extend({ bind_events: function() { var self = this; this.$el.on('mouseenter', '.oe_systray > div:not([data-toggle=tooltip])', function() { - $(this).attr('data-toggle', 'tooltip').tooltip().trigger('mouseenter'); + $(this).attr('data-toggle', 'tooltip').tooltip({placement: 'bottom', html: true}).trigger('mouseenter'); }); this.$el.on('click', '.oe_dropdown_toggle', function(ev) { ev.preventDefault(); diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index c3ef682bfcc..50535150bf3 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -400,7 +400,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.query = new my.SearchQuery() .on('add change reset remove', this.proxy('do_search')) .on('add change reset remove', this.proxy('renderFacets')); - + $('.oe_searchview_unfold_drawer').tooltip({html: true}); if (this.options.hidden) { this.$el.hide(); } From ff5cc4d5d37e0580cb9ee20d963ad99a51389d21 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 12:19:03 +0530 Subject: [PATCH 08/28] [IMP]Container added for tooltip. bzr revid: bth@tinyerp.com-20131205064903-222sb09tcsy4x79u --- addons/web/static/src/css/base.css | 3 --- addons/web/static/src/js/chrome.js | 2 +- addons/web/static/src/js/views.js | 1 + addons/web_kanban/static/src/js/kanban.js | 5 +++-- .../web_kanban_sparkline/static/src/js/kanban_sparkline.js | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6188b3fc26e..b4e6d4a24b2 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -641,9 +641,6 @@ left: 12% !important; margin-top: 0.5px; } -.tooltip.bottom { - padding: 5px 0 !important; -} .openerp .oe_notebook { margin: 8px 0; padding: 0 16px; diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 848f9e1ec3c..b80dfff695a 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1262,7 +1262,7 @@ instance.web.Client = instance.web.Widget.extend({ bind_events: function() { var self = this; this.$el.on('mouseenter', '.oe_systray > div:not([data-toggle=tooltip])', function() { - $(this).attr('data-toggle', 'tooltip').tooltip({placement: 'bottom', html: true}).trigger('mouseenter'); + $(this).attr('data-toggle', 'tooltip').tooltip({placement: 'bottom', html: true, container: 'body'}).trigger('mouseenter'); }); this.$el.on('click', '.oe_dropdown_toggle', function(ev) { ev.preventDefault(); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f9e8018b183..ed81ccc253f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1159,6 +1159,7 @@ instance.web.Sidebar = instance.web.Widget.extend({ self.$("[title]").tooltip({ 'html': true, + 'container': 'body', 'delayIn': 500, }); }, diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 962ad87a2b4..ab76ce7fc3d 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -626,7 +626,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ this.$records.data('widget', this); this.$has_been_started.resolve(); var add_btn = this.$el.find('.oe_kanban_add'); - add_btn.tooltip({delayIn: 500, delayOut: 1000}); + add_btn.tooltip({html: true, container: 'body', delayIn: 500, delayOut: 1000}); this.$records.find(".oe_kanban_column_cards").click(function (ev) { if (ev.target == ev.currentTarget) { if (!self.state.folded) { @@ -666,7 +666,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by]) .filter([["id", "=", this.value]]).first().then(function(res) { self.tooltip = res[options.tooltip_on_group_by]; - self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true, placement: 'bottom'}); + self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true, placement: 'bottom', container: 'body'}); }); } }, @@ -905,6 +905,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ placement: 'bottom', html: true, opacity: 0.8, + container: 'body' }); // If no draghandle is found, make the whole card as draghandle (provided one can edit) diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index df2ae6cd4bc..caa2b12377a 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -27,7 +27,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.tooltip({'html': true, 'title': function(){return title}, 'placement': 'bottom'}); + self.$el.tooltip({'html': true, 'title': function(){return title}, 'placement': 'bottom', 'container': 'body'}); }, 0); }, }); From 4543fe40a09fdfffd0a4e4efc9d04500d866913c Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 12:53:31 +0530 Subject: [PATCH 09/28] [IMP]On canvas added tooltip. bzr revid: bth@tinyerp.com-20131205072331-95yoyhvakb8hf453 --- addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index caa2b12377a..d9a85428979 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -27,7 +27,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.tooltip({'html': true, 'title': function(){return title}, 'placement': 'bottom', 'container': 'body'}); + self.$el.children().tooltip({'html': true, 'title': function(){return title}, 'container': 'body', 'placement': 'bottom'}); }, 0); }, }); From 63d66614c55b9e4947e84947cd210985362acf38 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 13:04:31 +0530 Subject: [PATCH 10/28] [IMP]Add attribute. bzr revid: bth@tinyerp.com-20131205073431-rcmnwyph2fn0hzu8 --- addons/web/static/src/js/search.js | 1 + addons/web/static/src/js/views.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 50535150bf3..0af8b451312 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -400,6 +400,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.query = new my.SearchQuery() .on('add change reset remove', this.proxy('do_search')) .on('add change reset remove', this.proxy('renderFacets')); + $('.oe_searchview_unfold_drawer').attr('data-toggle', 'tooltip'); $('.oe_searchview_unfold_drawer').tooltip({html: true}); if (this.options.hidden) { this.$el.hide(); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index ed81ccc253f..625eb4799eb 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1156,7 +1156,7 @@ instance.web.Sidebar = instance.web.Widget.extend({ this.$('.oe_form_dropdown_section').each(function() { $(this).toggle(!!$(this).find('li').length); }); - + self.$("[title]").attr('data-toggle', 'tooltip'); self.$("[title]").tooltip({ 'html': true, 'container': 'body', From 21ac480edfbe3c01251aa300639e45242dcdffc9 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 16:47:14 +0530 Subject: [PATCH 11/28] [IMP]Add tooltip in kanban record and search view. bzr revid: bth@tinyerp.com-20131205111714-zat05ycom5wtjzfd --- addons/web/static/src/js/search.js | 5 ++++- addons/web_kanban/static/src/js/kanban.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 0af8b451312..9022c8dbbe7 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1841,7 +1841,10 @@ instance.web.search.Filters = instance.web.search.Input.extend({ return $.when( this.render_column(col1, $('
').appendTo(this.$el)), - this.render_column(col2, $('
').appendTo(this.$el))); + this.render_column(col2, $('
').appendTo(this.$el))).then(function () { + self.$el.children().find('[title]').attr('data-toggle', 'tooltip'); + self.$el.children().find('[title]').tooltip({placement: 'bottom', html: true, container: 'body'}); + }); }, render_column: function (column, $el) { return $.when.apply(null, _(column).map(function (group) { diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index ab76ce7fc3d..98355d99d83 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -894,7 +894,8 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ bind_events: function() { var self = this; this.setup_color_picker(); - this.$el.find('[tooltip]').tooltip({ + this.$el.find('[title]').attr('data-toggle', 'tooltip'); + this.$el.find('[data-toggle]').tooltip({ title: function() { var template = $(this).attr('tooltip'); if (!self.view.qweb.has_template(template)) { From e2466df634070b5deedffc4a2ce963cb3233269b Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 5 Dec 2013 19:02:43 +0530 Subject: [PATCH 12/28] [IMP]Add tooltip for gantt view. bzr revid: bth@tinyerp.com-20131205133243-axu3hkmicy7tq1lt --- addons/web_gantt/static/src/js/gantt.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js index 74a1aa9e0ed..8cee29cf2fd 100644 --- a/addons/web_gantt/static/src/js/gantt.js +++ b/addons/web_gantt/static/src/js/gantt.js @@ -202,6 +202,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({ } // Fix for IE to display the content of gantt view. this.$el.find(".oe_gantt td:first > div, .oe_gantt td:eq(1) > div > div").css("overflow", ""); + this.$el.children().find('[title]').attr('data-toggle', 'tooltip').tooltip({placement: 'bottom', container: 'body', html: true}); }, on_task_changed: function(task_obj) { var self = this; From 188d42650009a5a4672b847158b481a43e7e5056 Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Fri, 6 Dec 2013 10:57:56 +0530 Subject: [PATCH 13/28] [IMP]Add sass changes. bzr revid: bth@tinyerp.com-20131206052756-bqizhcsf2jwjn05k --- addons/web/static/src/css/base.sass | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e9a51370192..cf72a287549 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -534,6 +534,7 @@ $sheet-padding: 16px // Tooltips {{{ &.oe_tooltip font-size: 12px + background-color: transparent .oe_tooltip_string color: #FD5 font-weight: bold @@ -557,6 +558,11 @@ $sheet-padding: 16px cursor: pointer .oe_tooltip_message max-width: 310px + .tooltip-inner + text-align: left !important + .tooltip.bottom .tooltip-arrow + left: 12% !important + margin-top: 0.5px // }}} // Notebook {{{ .oe_notebook From 6ccb6423ead8a24c4dfe3d2033454d91acc168ec Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Fri, 6 Dec 2013 11:51:52 +0530 Subject: [PATCH 14/28] [IMP]Destroy tooltip. bzr revid: bth@tinyerp.com-20131206062152-15fi8v8xokyux40m --- addons/web/static/src/js/views.js | 1 + addons/web_kanban/static/src/js/kanban.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 625eb4799eb..63aba1dbde5 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -586,6 +586,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ this.$el.find('.oe_view_manager_switch a').attr('data-toggle', 'tooltip'); this.$el.find('.oe_view_manager_switch a').click(function() { self.switch_mode($(this).data('view-type')); + $(this).tooltip('destroy'); }).tooltip({ container: 'body', html: true, diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 98355d99d83..fde6a468715 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -423,7 +423,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; - $.fn.tooltip('destroy'); + record.$el.children().find('[title]').tooltip('destroy'); $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); if (old_group === new_group) { new_group.records.splice(old_index, 1); From ec96bb513b89c100873a0b7554bbd8941ba52b6e Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Wed, 11 Dec 2013 16:30:30 +0530 Subject: [PATCH 15/28] [IMP]Tooltip when field have help and on debug mode. bzr revid: bth@tinyerp.com-20131211110030-tz3jf992ndmjgqe9 --- addons/web/static/src/js/view_form.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 05538fad897..d10bd7a97a5 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2104,8 +2104,9 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.$el.find('.oe_field_translate').click(this.on_translate); } this.$label = this.view ? this.view.$el.find('label[for=' + this.id_for_label + ']') : $(); - if (instance.session.debug) { + if (this.field.help || instance.session.debug) this.do_attach_tooltip(this, this.$label[0] || this.$el); + if (instance.session.debug) { this.$label.off('dblclick').on('dblclick', function() { console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view); window.w = self; From 898c293e25eddd86fe6794113e3c21147641d09b Mon Sep 17 00:00:00 2001 From: bth-openerp Date: Thu, 12 Dec 2013 16:03:42 +0530 Subject: [PATCH 16/28] [IMP]\n replaced by
. bzr revid: bth@tinyerp.com-20131212103342-tddr7vr29zud3vwb --- addons/web/static/lib/bootstrap/js/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/lib/bootstrap/js/tooltip.js b/addons/web/static/lib/bootstrap/js/tooltip.js index 5bc53a2d7cc..c8bca5bcfb5 100644 --- a/addons/web/static/lib/bootstrap/js/tooltip.js +++ b/addons/web/static/lib/bootstrap/js/tooltip.js @@ -250,7 +250,7 @@ Tooltip.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() - + title = title.search("oe_tooltip_string") != -1 ? title : title.replace(/\n/g, "
"); $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } From 9c3edd5d6db9be3ad8c28ee5035c0cb6852793a1 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 17 Dec 2013 12:40:04 +0530 Subject: [PATCH 17/28] [REM]removed tooltip.js which is not needed. tooltip included in bootstrap.js. bzr revid: kch@tinyerp.com-20131217071004-4upcf6b5bmlok1v9 --- addons/web/__openerp__.py | 1 - addons/web/static/lib/bootstrap/js/tooltip.js | 386 ------------------ 2 files changed, 387 deletions(-) delete mode 100644 addons/web/static/lib/bootstrap/js/tooltip.js diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index caa0595436b..0b66855ed00 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -43,7 +43,6 @@ This module provides the core of the OpenERP Web Client. "static/lib/cleditor/jquery.cleditor.js", "static/lib/py.js/lib/py.js", "static/src/js/openerpframework.js", - "static/lib/bootstrap/js/tooltip.js", "static/src/js/boot.js", "static/src/js/testing.js", "static/src/js/pyeval.js", diff --git a/addons/web/static/lib/bootstrap/js/tooltip.js b/addons/web/static/lib/bootstrap/js/tooltip.js deleted file mode 100644 index c8bca5bcfb5..00000000000 --- a/addons/web/static/lib/bootstrap/js/tooltip.js +++ /dev/null @@ -1,386 +0,0 @@ -/* ======================================================================== - * Bootstrap: tooltip.js v3.0.2 - * http://getbootstrap.com/javascript/#tooltip - * Inspired by the original jQuery.tipsy by Jason Frame - * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ======================================================================== */ - - -+function ($) { "use strict"; - - // TOOLTIP PUBLIC CLASS DEFINITION - // =============================== - - var Tooltip = function (element, options) { - this.type = - this.options = - this.enabled = - this.timeout = - this.hoverState = - this.$element = null - - this.init('tooltip', element, options) - } - - Tooltip.DEFAULTS = { - animation: true - , placement: 'top' - , selector: false - , template: '
' - , trigger: 'hover focus' - , title: '' - , delay: 0 - , html: false - , container: false - } - - Tooltip.prototype.init = function (type, element, options) { - this.enabled = true - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) - - var triggers = this.options.trigger.split(' ') - - for (var i = triggers.length; i--;) { - var trigger = triggers[i] - - if (trigger == 'click') { - this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) - } else if (trigger != 'manual') { - var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' - var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' - - this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) - } - } - - this.options.selector ? - (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() - } - - Tooltip.prototype.getDefaults = function () { - return Tooltip.DEFAULTS - } - - Tooltip.prototype.getOptions = function (options) { - options = $.extend({}, this.getDefaults(), this.$element.data(), options) - - if (options.delay && typeof options.delay == 'number') { - options.delay = { - show: options.delay - , hide: options.delay - } - } - - return options - } - - Tooltip.prototype.getDelegateOptions = function () { - var options = {} - var defaults = this.getDefaults() - - this._options && $.each(this._options, function (key, value) { - if (defaults[key] != value) options[key] = value - }) - - return options - } - - Tooltip.prototype.enter = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) - - clearTimeout(self.timeout) - - self.hoverState = 'in' - - if (!self.options.delay || !self.options.delay.show) return self.show() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'in') self.show() - }, self.options.delay.show) - } - - Tooltip.prototype.leave = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) - - clearTimeout(self.timeout) - - self.hoverState = 'out' - - if (!self.options.delay || !self.options.delay.hide) return self.hide() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'out') self.hide() - }, self.options.delay.hide) - } - - Tooltip.prototype.show = function () { - var e = $.Event('show.bs.'+ this.type) - - if (this.hasContent() && this.enabled) { - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - var $tip = this.tip() - - this.setContent() - - if (this.options.animation) $tip.addClass('fade') - - var placement = typeof this.options.placement == 'function' ? - this.options.placement.call(this, $tip[0], this.$element[0]) : - this.options.placement - - var autoToken = /\s?auto?\s?/i - var autoPlace = autoToken.test(placement) - if (autoPlace) placement = placement.replace(autoToken, '') || 'top' - - $tip - .detach() - .css({ top: 0, left: 0, display: 'block' }) - .addClass(placement) - - $tip.openerpClass('oe_tooltip') - this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) - - var pos = this.getPosition() - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - if (autoPlace) { - var $parent = this.$element.parent() - - var orgPlacement = placement - var docScroll = document.documentElement.scrollTop || document.body.scrollTop - var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth() - var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight() - var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left - - placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : - placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' : - placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' : - placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' : - placement - - $tip - .removeClass(orgPlacement) - .addClass(placement) - } - - var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) - - this.applyPlacement(calculatedOffset, placement) - this.$element.trigger('shown.bs.' + this.type) - } - } - - Tooltip.prototype.applyPlacement = function(offset, placement) { - var replace - var $tip = this.tip() - var width = $tip[0].offsetWidth - var height = $tip[0].offsetHeight - - // manually read margins because getBoundingClientRect includes difference - var marginTop = parseInt($tip.css('margin-top'), 10) - var marginLeft = parseInt($tip.css('margin-left'), 10) - - // we must check for NaN for ie 8/9 - if (isNaN(marginTop)) marginTop = 0 - if (isNaN(marginLeft)) marginLeft = 0 - - offset.top = offset.top + marginTop - offset.left = offset.left + marginLeft - - $tip - .offset(offset) - .addClass('in') - - // check to see if placing tip in new offset caused the tip to resize itself - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (placement == 'top' && actualHeight != height) { - replace = true - offset.top = offset.top + height - actualHeight - } - - if (/bottom|top/.test(placement)) { - var delta = 0 - - if (offset.left < 0) { - delta = offset.left * -2 - offset.left = 0 - - $tip.offset(offset) - - actualWidth = $tip[0].offsetWidth - actualHeight = $tip[0].offsetHeight - } - - this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') - } else { - this.replaceArrow(actualHeight - height, actualHeight, 'top') - } - - if (replace) $tip.offset(offset) - } - - Tooltip.prototype.replaceArrow = function(delta, dimension, position) { - this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') - } - - Tooltip.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - title = title.search("oe_tooltip_string") != -1 ? title : title.replace(/\n/g, "
"); - $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) - $tip.removeClass('fade in top bottom left right') - } - - Tooltip.prototype.hide = function () { - var that = this - var $tip = this.tip() - var e = $.Event('hide.bs.' + this.type) - - function complete() { - if (that.hoverState != 'in') $tip.detach() - } - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - $tip.removeClass('in') - - $.support.transition && this.$tip.hasClass('fade') ? - $tip - .one($.support.transition.end, complete) - .emulateTransitionEnd(150) : - complete() - - this.$element.trigger('hidden.bs.' + this.type) - - return this - } - - Tooltip.prototype.fixTitle = function () { - var $e = this.$element - if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { - $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') - } - } - - Tooltip.prototype.hasContent = function () { - return this.getTitle() - } - - Tooltip.prototype.getPosition = function () { - var el = this.$element[0] - return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { - width: el.offsetWidth - , height: el.offsetHeight - }, this.$element.offset()) - } - - Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement == 'bottom' ? { top: pos.top + pos.height, left: (pos.left + pos.width / 2 - actualWidth / 2) + actualWidth/3} : - placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } - } - - Tooltip.prototype.getTitle = function () { - var title - var $e = this.$element - var o = this.options - - title = $e.attr('data-original-title') - || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) - - return title - } - - Tooltip.prototype.tip = function () { - return this.$tip = this.$tip || $(this.options.template) - } - - Tooltip.prototype.arrow = function () { - return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') - } - - Tooltip.prototype.validate = function () { - if (!this.$element[0].parentNode) { - this.hide() - this.$element = null - this.options = null - } - } - - Tooltip.prototype.enable = function () { - this.enabled = true - } - - Tooltip.prototype.disable = function () { - this.enabled = false - } - - Tooltip.prototype.toggleEnabled = function () { - this.enabled = !this.enabled - } - - Tooltip.prototype.toggle = function (e) { - var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this - self.tip().hasClass('in') ? self.leave(self) : self.enter(self) - } - - Tooltip.prototype.destroy = function () { - this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) - } - - - // TOOLTIP PLUGIN DEFINITION - // ========================= - - var old = $.fn.tooltip - - $.fn.tooltip = function (option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tooltip') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - $.fn.tooltip.Constructor = Tooltip - - - // TOOLTIP NO CONFLICT - // =================== - - $.fn.tooltip.noConflict = function () { - $.fn.tooltip = old - return this - } - -}(jQuery); From 40a4a06d068c639b873e3936efb58159f1dd7709 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 17 Dec 2013 13:01:58 +0530 Subject: [PATCH 18/28] [IMP]improved css for tooltip bottom, bottom arrow, text alignment. bzr revid: kch@tinyerp.com-20131217073158-zjy4wbxenchxk2ax --- addons/web/static/src/css/base.css | 20 ++++++++++---------- addons/web/static/src/css/base.sass | 12 +++++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b4e6d4a24b2..25d2bf2441f 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "utf-8"; +@charset "UTF-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -634,13 +634,6 @@ .openerp.oe_tooltip .oe_tooltip_message { max-width: 310px; } -.tooltip-inner { - text-align: left !important; -} -.tooltip.bottom .tooltip-arrow { - left: 12% !important; - margin-top: 0.5px; -} .openerp .oe_notebook { margin: 8px 0; padding: 0 16px; @@ -2298,7 +2291,7 @@ } .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span { font-size: 80%; - color: darkGreen; + color: darkgreen; vertical-align: top; position: relative; top: -4px; @@ -3442,7 +3435,6 @@ div.ui-widget-overlay { overflow: hidden !important; } } - .nav li > a { padding: 3px 4px 2px 18px; color: #4c4c4c; @@ -3471,6 +3463,14 @@ div.ui-widget-overlay { background-color: #7c7bad; } +.tooltip-inner { + text-align: left; +} + +.tooltip.bottom .tooltip-arrow { + left: 35%; +} + button, body { line-height: normal; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index cf72a287549..541a7f66d88 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -558,11 +558,6 @@ $sheet-padding: 16px cursor: pointer .oe_tooltip_message max-width: 310px - .tooltip-inner - text-align: left !important - .tooltip.bottom .tooltip-arrow - left: 12% !important - margin-top: 0.5px // }}} // Notebook {{{ .oe_notebook @@ -2770,6 +2765,13 @@ div.ui-widget-overlay background-color: #7c7bad // End of customize +// Customize bootstrap3 for tooltip +.tooltip-inner + text-align: left +.tooltip.bottom .tooltip-arrow + left: 35% +// End of customize + // Customize for global tags button, body line-height: normal From 3fcd2e2440a7a5e87f7451453decf1462000ea35 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 17 Dec 2013 15:05:46 +0530 Subject: [PATCH 19/28] [IMP]Improved code for set tooltip placement on top or bottom on the basis of display area. bzr revid: kch@tinyerp.com-20131217093546-49lg5i0rm1kx9oli --- addons/web/static/src/css/base.css | 4 ++-- addons/web/static/src/css/base.sass | 4 ++-- addons/web/static/src/js/search.js | 2 +- addons/web/static/src/js/view_form.js | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 25d2bf2441f..06239a389cd 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3464,11 +3464,11 @@ div.ui-widget-overlay { } .tooltip-inner { - text-align: left; + text-align: left !important; } .tooltip.bottom .tooltip-arrow { - left: 35%; + left: 35% !important; } button, body { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 541a7f66d88..e74fae44206 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2767,9 +2767,9 @@ div.ui-widget-overlay // Customize bootstrap3 for tooltip .tooltip-inner - text-align: left + text-align: left !important .tooltip.bottom .tooltip-arrow - left: 35% + left: 35% !important // End of customize // Customize for global tags diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 1cc2b4815d0..994673021a3 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -401,7 +401,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea .on('add change reset remove', this.proxy('do_search')) .on('add change reset remove', this.proxy('renderFacets')); $('.oe_searchview_unfold_drawer').attr('data-toggle', 'tooltip'); - $('.oe_searchview_unfold_drawer').tooltip({html: true}); + $('.oe_searchview_unfold_drawer').tooltip({placement: 'bottom', html: true}); if (this.options.hidden) { this.$el.hide(); } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d10bd7a97a5..7ffbffd44f3 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1862,7 +1862,12 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi }); }, container: 'body', - placement: 'bottom', + placement: function(tip, trigger) { //dynamic set position + var offset = $(trigger).offset(); + var vert = 0.5 * $(document).outerHeight() - offset.top; + var vertPlacement = vert > 0 ? 'bottom' : 'top'; + return vertPlacement; + }, html: true, opacity: 0.85, }, options || {}); From e6112472cede1ee52497e8f91541fbaf8d5a7531 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 17 Dec 2013 15:11:57 +0530 Subject: [PATCH 20/28] [FIX]css issue. bzr revid: kch@tinyerp.com-20131217094157-i45wv6xs1uz38kin --- addons/web/static/lib/bootstrap/js/bootstrap.js | 2 +- addons/web/static/src/css/base.css | 3 ++- addons/web/static/src/css/base.sass | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/web/static/lib/bootstrap/js/bootstrap.js b/addons/web/static/lib/bootstrap/js/bootstrap.js index 1c638ab4410..ba2d887a0fd 100644 --- a/addons/web/static/lib/bootstrap/js/bootstrap.js +++ b/addons/web/static/lib/bootstrap/js/bootstrap.js @@ -1141,7 +1141,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + //this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 06239a389cd..008d811f30c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3465,10 +3465,11 @@ div.ui-widget-overlay { .tooltip-inner { text-align: left !important; + max-width: 250px; } .tooltip.bottom .tooltip-arrow { - left: 35% !important; + left: 50%; } button, body { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e74fae44206..549b89e2b21 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2768,8 +2768,9 @@ div.ui-widget-overlay // Customize bootstrap3 for tooltip .tooltip-inner text-align: left !important + max-width: 250px .tooltip.bottom .tooltip-arrow - left: 35% !important + left: 50% // End of customize // Customize for global tags From 7e40734c20b0ed8335603ef29a25182836763a08 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 17 Dec 2013 15:14:38 +0530 Subject: [PATCH 21/28] [FIX]forgot to uncomment code. bzr revid: kch@tinyerp.com-20131217094438-kef28woejof2dovn --- addons/web/static/lib/bootstrap/js/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/lib/bootstrap/js/bootstrap.js b/addons/web/static/lib/bootstrap/js/bootstrap.js index ba2d887a0fd..1c638ab4410 100644 --- a/addons/web/static/lib/bootstrap/js/bootstrap.js +++ b/addons/web/static/lib/bootstrap/js/bootstrap.js @@ -1141,7 +1141,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - //this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } From 00362f60c987eb0ca44dc65902f4f9a0960af90a Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Wed, 18 Dec 2013 13:04:40 +0530 Subject: [PATCH 22/28] [IMP]customize bootstrap tooltip classes. bzr revid: kch@tinyerp.com-20131218073440-c7sfdn0jfw0cw83n --- addons/web/static/src/css/base.css | 80 +++++++++++++++-------------- addons/web/static/src/css/base.sass | 68 ++++++++++++------------ 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 008d811f30c..4dce5647458 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -599,41 +599,6 @@ font-style: italic; text-decoration: none; } -.openerp.oe_tooltip { - font-size: 12px; - background-color: transparent; -} -.openerp.oe_tooltip .oe_tooltip_string { - color: #ffdd55; - font-weight: bold; - font-size: 13px; -} -.openerp.oe_tooltip .oe_tooltip_help { - white-space: pre-wrap; -} -.openerp.oe_tooltip .oe_tooltip_technical { - padding: 0 0 4px 0; - margin: 5px 0 0 15px; -} -.openerp.oe_tooltip .oe_tooltip_technical li { - list-style: circle; -} -.openerp.oe_tooltip .oe_tooltip_technical_title { - font-weight: bold; -} -.openerp.oe_tooltip .oe_tooltip_close { - margin: -5px 0 0 2px; - cursor: default; - float: right; - color: white; -} -.openerp.oe_tooltip .oe_tooltip_close:hover { - color: #999999; - cursor: pointer; -} -.openerp.oe_tooltip .oe_tooltip_message { - max-width: 310px; -} .openerp .oe_notebook { margin: 8px 0; padding: 0 16px; @@ -3463,13 +3428,50 @@ div.ui-widget-overlay { background-color: #7c7bad; } -.tooltip-inner { +.tooltip { + padding: 0; + margin: 0; + font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif; + color: #4c4c4c; + font-size: 12px; + background: white; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); + background-color: transparent; +} +.tooltip .tooltip-inner { text-align: left !important; max-width: 250px; } - -.tooltip.bottom .tooltip-arrow { - left: 50%; +.tooltip .tooltip-inner .oe_tooltip_string { + color: #ffdd55; + font-weight: bold; + font-size: 13px; +} +.tooltip .tooltip-inner .oe_tooltip_help { + white-space: pre-wrap; +} +.tooltip .tooltip-inner .oe_tooltip_technical { + padding: 0 0 4px 0; + margin: 5px 0 0 15px; +} +.tooltip .tooltip-inner .oe_tooltip_technical li { + list-style: circle; +} +.tooltip .tooltip-inner .oe_tooltip_technical_title { + font-weight: bold; +} +.tooltip .tooltip-inner .oe_tooltip_close { + margin: -5px 0 0 2px; + cursor: default; + float: right; + color: white; +} +.tooltip .tooltip-inner .oe_tooltip_close:hover { + color: #999999; + cursor: pointer; +} +.tooltip .tooltip-inner .oe_tooltip_message { + max-width: 310px; } button, body { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 549b89e2b21..941ce32231c 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -531,34 +531,6 @@ $sheet-padding: 16px text-decoration: none margin-bottom: 1px // }}} - // Tooltips {{{ - &.oe_tooltip - font-size: 12px - background-color: transparent - .oe_tooltip_string - color: #FD5 - font-weight: bold - font-size: 13px - .oe_tooltip_help - white-space: pre-wrap - .oe_tooltip_technical - padding: 0 0 4px 0 - margin: 5px 0 0 15px - li - list-style: circle - .oe_tooltip_technical_title - font-weight: bold - .oe_tooltip_close - margin: -5px 0 0 2px - cursor: default - float: right - color: white - &:hover - color: #999 - cursor: pointer - .oe_tooltip_message - max-width: 310px - // }}} // Notebook {{{ .oe_notebook margin: 8px 0 @@ -2766,11 +2738,41 @@ div.ui-widget-overlay // End of customize // Customize bootstrap3 for tooltip -.tooltip-inner - text-align: left !important - max-width: 250px -.tooltip.bottom .tooltip-arrow - left: 50% +.tooltip + padding: 0 + margin: 0 + font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif + color: #4c4c4c + font-size: 12px + background: white + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5) + background-color: transparent + .tooltip-inner + text-align: left !important + max-width: 250px + .oe_tooltip_string + color: #FD5 + font-weight: bold + font-size: 13px + .oe_tooltip_help + white-space: pre-wrap + .oe_tooltip_technical + padding: 0 0 4px 0 + margin: 5px 0 0 15px + li + list-style: circle + .oe_tooltip_technical_title + font-weight: bold + .oe_tooltip_close + margin: -5px 0 0 2px + cursor: default + float: right + color: white + &:hover + color: #999 + cursor: pointer + .oe_tooltip_message + max-width: 310px // End of customize // Customize for global tags From 012a42a6f17c4d91c191593716cd9a5c995fb1a0 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Wed, 18 Dec 2013 13:07:09 +0530 Subject: [PATCH 23/28] [REM]removed tipsy library. bzr revid: kch@tinyerp.com-20131218073709-yv4161e0u4exnwgr --- .../static/lib/jquery.tipsy/jquery.tipsy.js | 250 ------------------ addons/web/static/lib/jquery.tipsy/tipsy.css | 25 -- 2 files changed, 275 deletions(-) delete mode 100644 addons/web/static/lib/jquery.tipsy/jquery.tipsy.js delete mode 100644 addons/web/static/lib/jquery.tipsy/tipsy.css diff --git a/addons/web/static/lib/jquery.tipsy/jquery.tipsy.js b/addons/web/static/lib/jquery.tipsy/jquery.tipsy.js deleted file mode 100644 index e978042f21b..00000000000 --- a/addons/web/static/lib/jquery.tipsy/jquery.tipsy.js +++ /dev/null @@ -1,250 +0,0 @@ -// tipsy, facebook style tooltips for jquery -// version 1.0.0a -// (c) 2008-2010 jason frame [jason@onehackoranother.com] -// released under the MIT license - -(function($) { - - function maybeCall(thing, ctx) { - return (typeof thing == 'function') ? (thing.call(ctx)) : thing; - }; - - function Tipsy(element, options) { - this.$element = $(element); - this.options = options; - this.enabled = true; - this.fixTitle(); - }; - - Tipsy.prototype = { - show: function() { - $.fn.tipsy.clear(); - if (!this.$element.parent().length) { - return; - } - var title = this.getTitle(); - if (title && this.enabled) { - var $tip = this.tip(); - - $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); - $tip[0].className = 'tipsy '; // reset classname in case of dynamic gravity - $tip.openerpClass('oe_tooltip'); - $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body); - - var pos = $.extend({}, this.$element.offset(), { - width: this.$element[0].offsetWidth, - height: this.$element[0].offsetHeight - }); - - var actualWidth = $tip[0].offsetWidth, - actualHeight = $tip[0].offsetHeight, - gravity = maybeCall(this.options.gravity, this.$element[0]); - - var tp; - switch (gravity.charAt(0)) { - case 'n': - tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; - break; - case 's': - tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}; - break; - case 'e': - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}; - break; - case 'w': - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}; - break; - } - - if (gravity.length == 2) { - if (gravity.charAt(1) == 'w') { - tp.left = pos.left + pos.width / 2 - 15; - } else { - tp.left = pos.left + pos.width / 2 - actualWidth + 15; - } - } - - $tip.css(tp).addClass('tipsy-' + gravity); - $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0); - if (this.options.className) { - $tip.addClass(maybeCall(this.options.className, this.$element[0])); - } - - if (this.options.fade) { - $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity}); - } else { - $tip.css({visibility: 'visible', opacity: this.options.opacity}); - } - } - }, - - hide: function() { - if (this.options.fade) { - this.tip().stop().fadeOut(function() { $(this).remove(); }); - } else { - this.tip().remove(); - } - }, - - fixTitle: function() { - var $e = this.$element; - if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') { - $e.attr('original-title', $e.attr('title') || '').removeAttr('title'); - } - }, - - getTitle: function() { - var title, $e = this.$element, o = this.options; - this.fixTitle(); - var title, o = this.options; - if (typeof o.title == 'string') { - title = $e.attr(o.title == 'title' ? 'original-title' : o.title); - } else if (typeof o.title == 'function') { - title = o.title.call($e[0]); - } - title = ('' + title).replace(/(^\s*|\s*$)/, ""); - return title || o.fallback; - }, - - tip: function() { - if (!this.$tip) { - this.$tip = $('
').html('
'); - } - return this.$tip; - }, - - validate: function() { - if (!this.$element[0].parentNode) { - this.hide(); - this.$element = null; - this.options = null; - } - }, - - enable: function() { this.enabled = true; }, - disable: function() { this.enabled = false; }, - toggleEnabled: function() { this.enabled = !this.enabled; } - }; - - $.fn.tipsy = function(options) { - - if (options === true) { - return this.data('tipsy'); - } else if (typeof options == 'string') { - var tipsy = this.data('tipsy'); - if (tipsy) tipsy[options](); - return this; - } - - options = $.extend({}, $.fn.tipsy.defaults, options); - - function get(ele) { - var tipsy = $.data(ele, 'tipsy'); - if (!tipsy) { - tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options)); - $.data(ele, 'tipsy', tipsy); - } - return tipsy; - } - - function enter() { - var tipsy = get(this); - tipsy.hoverState = 'in'; - if (options.delayIn == 0) { - tipsy.show(); - } else { - tipsy.fixTitle(); - setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); - } - }; - - function leave() { - var tipsy = get(this); - tipsy.hoverState = 'out'; - if (options.delayOut == 0) { - tipsy.hide(); - } else { - setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut); - } - }; - - if (!options.live) this.each(function() { get(this); }); - - if (options.trigger != 'manual') { - var binder = options.live ? 'live' : 'bind', - eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus', - eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'; - this[binder](eventIn, enter)[binder](eventOut, leave); - } - - return this; - - }; - - $.fn.tipsy.clear = function() { - $('div.tipsy').stop().remove(); - } - - $.fn.tipsy.defaults = { - className: null, - delayIn: 0, - delayOut: 0, - fade: false, - fallback: '', - gravity: 'n', - html: false, - live: false, - offset: 0, - opacity: 0.8, - title: 'title', - trigger: 'hover' - }; - - // Overwrite this method to provide options on a per-element basis. - // For example, you could store the gravity in a 'tipsy-gravity' attribute: - // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' }); - // (remember - do not modify 'options' in place!) - $.fn.tipsy.elementOptions = function(ele, options) { - return $.metadata ? $.extend({}, options, $(ele).metadata()) : options; - }; - - $.fn.tipsy.autoNS = function() { - return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n'; - }; - - $.fn.tipsy.autoWE = function() { - return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w'; - }; - - /** - * yields a closure of the supplied parameters, producing a function that takes - * no arguments and is suitable for use as an autogravity function like so: - * - * @param margin (int) - distance from the viewable region edge that an - * element should be before setting its tooltip's gravity to be away - * from that edge. - * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer - * if there are no viewable region edges effecting the tooltip's - * gravity. It will try to vary from this minimally, for example, - * if 'sw' is preferred and an element is near the right viewable - * region edge, but not the top edge, it will set the gravity for - * that element's tooltip to be 'se', preserving the southern - * component. - */ - $.fn.tipsy.autoBounds = function(margin, prefer) { - return function() { - var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)}, - boundTop = $(document).scrollTop() + margin, - boundLeft = $(document).scrollLeft() + margin, - $this = $(this); - - if ($this.offset().top < boundTop) dir.ns = 'n'; - if ($this.offset().left < boundLeft) dir.ew = 'w'; - if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e'; - if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's'; - - return dir.ns + (dir.ew ? dir.ew : ''); - } - }; - -})(jQuery); diff --git a/addons/web/static/lib/jquery.tipsy/tipsy.css b/addons/web/static/lib/jquery.tipsy/tipsy.css deleted file mode 100644 index 59d0fb97b9e..00000000000 --- a/addons/web/static/lib/jquery.tipsy/tipsy.css +++ /dev/null @@ -1,25 +0,0 @@ -.tipsy { font-size: 90%; position: absolute; padding: 5px; z-index: 100000; overflow: hidden;} - .tipsy-inner { background-color: #000; color: #FFF; max-width: 500px; padding: 5px 8px 4px 8px; } - - /* Rounded corners */ - .tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } - - /* Uncomment for shadow */ - .tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; } - - .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; } - - /* Rules to colour arrows */ - .tipsy-arrow-n { border-bottom-color: #000; } - .tipsy-arrow-s { border-top-color: #000; } - .tipsy-arrow-e { border-left-color: #000; } - .tipsy-arrow-w { border-right-color: #000; } - - .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; } - .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} - .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;} - .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } - .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } - .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; } - .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; } - .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; } From 5e5483bde4bb6329aab389f68f09121426e43312 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 20 Dec 2013 13:02:41 +0530 Subject: [PATCH 24/28] [FIX]for dialog box stick to page. bzr revid: vme@tinyerp.com-20131220073241-xi7v47jecgewapw2 --- addons/web/static/src/js/chrome.js | 5 ++++- addons/web/static/src/js/view_form.js | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index b80dfff695a..a87af20af69 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -238,6 +238,10 @@ instance.web.Dialog = instance.web.Widget.extend({ if (this.dialog_inited && !this.isDestroyed() && this.$el.is(":data(dialog)")) { this.$el.dialog('destroy'); } + //For Remove tooltip from dialog box when destroy + //Bad fix, bootstrap mouseleave method call very late + //before that this.$el and its contained removed because that tooltip sticks on page. + $($.find('.tooltip.fade.in')).remove(); this._super(); } }); @@ -1287,7 +1291,6 @@ instance.web.Client = instance.web.Widget.extend({ }); instance.web.bus.on('click', this, function(ev) { $.fn.tooltip('destroy'); - this.$el.find('.oe_systray').find('div') if (!$(ev.target).is('input[type=file]')) { self.$el.find('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened'); } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 7ffbffd44f3..683794cac68 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1851,6 +1851,8 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget = widget || this; trigger = trigger || this.$el; options = _.extend({ + delay: { show: 750, hide: 0 }, + trigger: 'hover', title: function() { var template = widget.template + '.tooltip'; if (!QWeb.has_template(template)) { From 37fab3d03d3d6b99e0c65a4e3714d9c8b3f4bb01 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Wed, 16 Apr 2014 15:46:55 +0200 Subject: [PATCH 25/28] [FIX]few errors bzr revid: csn@openerp.com-20140416134655-1e4q8e8i30qj9y7t --- addons/web_kanban/static/src/js/kanban.js | 1 + addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 502249a64ed..d28051905d5 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -926,6 +926,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ var self = this; this.setup_color_picker(); this.$el.find('[title]').tooltip({ + delay: { show: 500, hide: 0}, title: function() { var template = $(this).attr('tooltip'); if (!self.view.qweb.has_template(template)) { diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index 5424977f023..9dc793024c4 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -29,7 +29,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.children().tooltip({delay: {show: self.options.delayIn || 0, hide: 0}, html: true, title: function(){return title}, placement: 'bottom'}); + self.$el.tooltip({delay: {show: self.options.delayIn || 0, hide: 0}, html: true, title: function(){return title}, placement: 'bottom'}); }, 0); }, }); From 347985e050a7163781a81e3344a130ffaa520e14 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 17 Apr 2014 10:59:54 +0200 Subject: [PATCH 26/28] [FIX]tooltip: overwrite bootstrap default for tooltip bzr revid: csn@openerp.com-20140417085954-mirh4eeotsorlyeo --- addons/web/static/src/js/chrome.js | 2 +- addons/web/static/src/js/core.js | 5 +++++ addons/web/static/src/js/view_form.js | 2 -- addons/web/static/src/js/views.js | 7 +------ addons/web_kanban/static/src/js/kanban.js | 8 +++----- .../static/src/js/kanban_sparkline.js | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 52d789a34f0..0d73aea5d35 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1076,7 +1076,7 @@ instance.web.Client = instance.web.Widget.extend({ bind_events: function() { var self = this; this.$el.on('mouseenter', '.oe_systray > div:not([data-toggle=tooltip])', function() { - $(this).attr('data-toggle', 'tooltip').tooltip({placement: 'bottom', html: true}).trigger('mouseenter'); + $(this).attr('data-toggle', 'tooltip').tooltip().trigger('mouseenter'); }); this.$el.on('click', '.oe_dropdown_toggle', function(ev) { ev.preventDefault(); diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 90c84ba9cda..6a234058333 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -788,6 +788,11 @@ instance.web.unblockUI = function() { return $.unblockUI.apply($, arguments); }; + +/* Bootstrap defaults overwrite */ +$.fn.tooltip.Constructor.DEFAULTS.placement = 'auto top'; +$.fn.tooltip.Constructor.DEFAULTS.html = true; + /** * Registry for all the client actions key: tag value: widget */ diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 25d83105642..3787678d7dd 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1876,8 +1876,6 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi widget: widget }); }, - placement: "auto top", - html: true, }, options || {}); $(trigger).tooltip(options); }, diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 7c98e324917..b9015f6b311 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -581,10 +581,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ var self = this; this.$el.find('.oe_view_manager_switch a').click(function() { self.switch_mode($(this).data('view-type')); - }).tooltip({ - placement: 'bottom', - html: true, - }); + }).tooltip(); var views_ids = {}; _.each(this.views_src, function(view) { self.views[view.view_type] = $.extend({}, view, { @@ -1161,8 +1158,6 @@ instance.web.Sidebar = instance.web.Widget.extend({ $(this).toggle(!!$(this).find('li').length); }); self.$("[title]").tooltip({ - html: true, - placement: 'bottom', delay: { show: 500, hide: 0} }); }, diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index d28051905d5..8db6c1e6fa7 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -441,7 +441,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; - record.$el.children().find('[title]').tooltip('destroy'); + record.$el.find('[title]').tooltip('destroy'); $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide(); if (old_group === new_group) { new_group.records.splice(old_index, 1); @@ -648,7 +648,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ this.$records.data('widget', this); this.$has_been_started.resolve(); var add_btn = this.$el.find('.oe_kanban_add'); - add_btn.tooltip({html: true, delay: { show: 500, hide:1000 }}); + add_btn.tooltip({delay: { show: 500, hide:1000 }}); this.$records.find(".oe_kanban_column_cards").click(function (ev) { if (ev.target == ev.currentTarget) { if (!self.state.folded) { @@ -688,7 +688,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({ return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by]) .filter([["id", "=", this.value]]).first().then(function(res) { self.tooltip = res[options.tooltip_on_group_by]; - self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip({html: true, placement: 'bottom'}); + self.$(".oe_kanban_group_title_text").attr("title", self.tooltip || self.title || "").tooltip(); }); } }, @@ -934,8 +934,6 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ } return self.view.qweb.render(template, self.qweb_context); }, - placement: 'bottom', - html: true, }); // If no draghandle is found, make the whole card as draghandle (provided one can edit) diff --git a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js index 9dc793024c4..dd2f9ca75d5 100644 --- a/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js +++ b/addons/web_kanban_sparkline/static/src/js/kanban_sparkline.js @@ -29,7 +29,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten } }, self.options); self.$el.sparkline(value, sparkline_options); - self.$el.tooltip({delay: {show: self.options.delayIn || 0, hide: 0}, html: true, title: function(){return title}, placement: 'bottom'}); + self.$el.tooltip({delay: {show: self.options.delayIn || 0, hide: 0}, title: function(){return title}}); }, 0); }, }); From 336fba01e50d20cd29fa820b3db61a3a0c30a299 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 17 Apr 2014 11:59:44 +0200 Subject: [PATCH 27/28] [FIX]tooltip: should not use placement auto since it is currently bugged in bootstrap (see: https://github.com/twbs/bootstrap/issues/13268) bzr revid: csn@openerp.com-20140417095944-3k2c8829tm6lmxmo --- addons/web/static/src/js/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 6a234058333..5339fa80615 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -790,7 +790,7 @@ instance.web.unblockUI = function() { /* Bootstrap defaults overwrite */ -$.fn.tooltip.Constructor.DEFAULTS.placement = 'auto top'; +$.fn.tooltip.Constructor.DEFAULTS.placement = 'bottom'; $.fn.tooltip.Constructor.DEFAULTS.html = true; /** From 4aec292e5cc5d96ccb4786a017905571a1131af7 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 17 Apr 2014 16:04:52 +0200 Subject: [PATCH 28/28] [FIX]tooltip: when not in debug mode, display tooltip in form view with bootstrat as well bzr revid: csn@openerp.com-20140417140452-afqwxqv8pbvpbs3m --- addons/web/static/src/js/view_form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 03b21febc78..6212cc3d549 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1880,7 +1880,11 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi }); }, }, options || {}); - $(trigger).tooltip(options); + //only show tooltip if we are in debug or if we have a help to show, otherwise it will display + //as empty + if (instance.session.debug || widget.node.attrs.help || (widget.field && widget.field.help)){ + $(trigger).tooltip(options); + } }, /** * Builds a new context usable for operations related to fields by merging @@ -2117,8 +2121,8 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.$el.find('.oe_field_translate').click(this.on_translate); } this.$label = this.view ? this.view.$el.find('label[for=' + this.id_for_label + ']') : $(); + this.do_attach_tooltip(this, this.$label[0] || this.$el); if (instance.session.debug) { - this.do_attach_tooltip(this, this.$label[0] || this.$el); this.$label.off('dblclick').on('dblclick', function() { console.log("Field '%s' of type '%s' in View: %o", self.name, (self.node.attrs.widget || self.field.type), self.view); window.w = self;