Merge pull request #784 from odoo-dev/saas-5-tooltip-fix-csn
[FIX]tooltip: fix various display problems with the tooltip
This commit is contained in:
commit
f909ae9170
|
@ -3366,6 +3366,7 @@ body.oe_single_form .oe_single_form_container {
|
||||||
background: white;
|
background: white;
|
||||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
z-index: 1800;
|
||||||
}
|
}
|
||||||
.tooltip .tooltip-inner {
|
.tooltip .tooltip-inner {
|
||||||
text-align: left !important;
|
text-align: left !important;
|
||||||
|
|
|
@ -2730,6 +2730,7 @@ body.oe_single_form
|
||||||
background: white
|
background: white
|
||||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5)
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5)
|
||||||
background-color: transparent
|
background-color: transparent
|
||||||
|
z-index: 1800
|
||||||
.tooltip-inner
|
.tooltip-inner
|
||||||
text-align: left !important
|
text-align: left !important
|
||||||
max-width: 350px
|
max-width: 350px
|
||||||
|
|
|
@ -183,6 +183,7 @@ instance.web.Dialog = instance.web.Widget.extend({
|
||||||
*/
|
*/
|
||||||
close: function(reason) {
|
close: function(reason) {
|
||||||
if (this.dialog_inited && !this.__tmp_dialog_hiding) {
|
if (this.dialog_inited && !this.__tmp_dialog_hiding) {
|
||||||
|
$('.tooltip').remove(); //remove open tooltip if any to prevent them staying when modal has disappeared
|
||||||
this.trigger("closing", reason);
|
this.trigger("closing", reason);
|
||||||
if (this.$el.is(":data(bs.modal)")) { // may have been destroyed by closing signal
|
if (this.$el.is(":data(bs.modal)")) { // may have been destroyed by closing signal
|
||||||
this.__tmp_dialog_hiding = true;
|
this.__tmp_dialog_hiding = true;
|
||||||
|
|
|
@ -773,15 +773,18 @@ instance.web.unblockUI = function() {
|
||||||
$.fn.tooltip.Constructor.DEFAULTS.placement = 'auto top';
|
$.fn.tooltip.Constructor.DEFAULTS.placement = 'auto top';
|
||||||
$.fn.tooltip.Constructor.DEFAULTS.html = true;
|
$.fn.tooltip.Constructor.DEFAULTS.html = true;
|
||||||
$.fn.tooltip.Constructor.DEFAULTS.container = 'body';
|
$.fn.tooltip.Constructor.DEFAULTS.container = 'body';
|
||||||
//overwrite bootstrap tooltip method to fix bug when using placement
|
//overwrite bootstrap tooltip method to prevent showing 2 tooltip at the same time
|
||||||
//auto and the parent element does not exist anymore resulting in
|
|
||||||
//an error. This should be remove once bootstrap fix the bug
|
|
||||||
var bootstrap_show_function = $.fn.tooltip.Constructor.prototype.show;
|
var bootstrap_show_function = $.fn.tooltip.Constructor.prototype.show;
|
||||||
$.fn.tooltip.Constructor.prototype.show = function (e) {
|
$.fn.tooltip.Constructor.prototype.show = function () {
|
||||||
if (this.$element.parent().length === 0){
|
$('.tooltip').remove();
|
||||||
return;
|
//the following fix the bug when using placement
|
||||||
}
|
//auto and the parent element does not exist anymore resulting in
|
||||||
return bootstrap_show_function.call(this, e);
|
//an error. This should be remove once we updade bootstrap to a version that fix the bug
|
||||||
|
//edit: bug has been fixed here : https://github.com/twbs/bootstrap/pull/13752
|
||||||
|
var e = $.Event('show.bs.' + this.type);
|
||||||
|
var inDom = $.contains(document.documentElement, this.$element[0]);
|
||||||
|
if (e.isDefaultPrevented() || !inDom) return;
|
||||||
|
return bootstrap_show_function.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1869,25 +1869,9 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
|
||||||
do_attach_tooltip: function(widget, trigger, options) {
|
do_attach_tooltip: function(widget, trigger, options) {
|
||||||
widget = widget || this;
|
widget = widget || this;
|
||||||
trigger = trigger || this.$el;
|
trigger = trigger || this.$el;
|
||||||
var container = 'body';
|
|
||||||
/*TODO: need to be refactor
|
|
||||||
in the case we can find the view form in the parent,
|
|
||||||
attach the element to it (to prevent tooltip to keep showing
|
|
||||||
when switching view) or if we have a modal currently showing,
|
|
||||||
attach tooltip to the modal to prevent the tooltip to show in the body in the
|
|
||||||
case we close the modal too fast*/
|
|
||||||
if ($(trigger).parents('.oe_view_manager_view_form').length > 0){
|
|
||||||
container = $(trigger).parents('.oe_view_manager_view_form');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (window.$('.modal.in').length>0){
|
|
||||||
container = window.$('.modal.in:last()');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
options = _.extend({
|
options = _.extend({
|
||||||
delay: { show: 500, hide: 0 },
|
delay: { show: 500, hide: 0 },
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
container: container,
|
|
||||||
title: function() {
|
title: function() {
|
||||||
var template = widget.template + '.tooltip';
|
var template = widget.template + '.tooltip';
|
||||||
if (!QWeb.has_template(template)) {
|
if (!QWeb.has_template(template)) {
|
||||||
|
|
|
@ -926,10 +926,6 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
this.setup_color_picker();
|
this.setup_color_picker();
|
||||||
this.$el.find('[title]').each(function(){
|
this.$el.find('[title]').each(function(){
|
||||||
//in case of kanban, attach tooltip to the element itself
|
|
||||||
//otherwise it might stay on screen when kanban view reload
|
|
||||||
//since default container is body.
|
|
||||||
//(when clicking on ready for next stage for example)
|
|
||||||
$(this).tooltip({
|
$(this).tooltip({
|
||||||
delay: { show: 500, hide: 0},
|
delay: { show: 500, hide: 0},
|
||||||
container: $(this),
|
container: $(this),
|
||||||
|
|
Loading…
Reference in New Issue