From 347985e050a7163781a81e3344a130ffaa520e14 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 17 Apr 2014 10:59:54 +0200 Subject: [PATCH] [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); }, });