[FIX]tooltip: overwrite bootstrap default for tooltip

bzr revid: csn@openerp.com-20140417085954-mirh4eeotsorlyeo
This commit is contained in:
Cedric Snauwaert 2014-04-17 10:59:54 +02:00
parent 37fab3d03d
commit 347985e050
6 changed files with 11 additions and 15 deletions

View File

@ -1076,7 +1076,7 @@ instance.web.Client = instance.web.Widget.extend({
bind_events: function() { bind_events: function() {
var self = this; var self = this;
this.$el.on('mouseenter', '.oe_systray > div:not([data-toggle=tooltip])', function() { 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) { this.$el.on('click', '.oe_dropdown_toggle', function(ev) {
ev.preventDefault(); ev.preventDefault();

View File

@ -788,6 +788,11 @@ instance.web.unblockUI = function() {
return $.unblockUI.apply($, arguments); 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 * Registry for all the client actions key: tag value: widget
*/ */

View File

@ -1876,8 +1876,6 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
widget: widget widget: widget
}); });
}, },
placement: "auto top",
html: true,
}, options || {}); }, options || {});
$(trigger).tooltip(options); $(trigger).tooltip(options);
}, },

View File

@ -581,10 +581,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
var self = this; var self = this;
this.$el.find('.oe_view_manager_switch a').click(function() { this.$el.find('.oe_view_manager_switch a').click(function() {
self.switch_mode($(this).data('view-type')); self.switch_mode($(this).data('view-type'));
}).tooltip({ }).tooltip();
placement: 'bottom',
html: true,
});
var views_ids = {}; var views_ids = {};
_.each(this.views_src, function(view) { _.each(this.views_src, function(view) {
self.views[view.view_type] = $.extend({}, 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); $(this).toggle(!!$(this).find('li').length);
}); });
self.$("[title]").tooltip({ self.$("[title]").tooltip({
html: true,
placement: 'bottom',
delay: { show: 500, hide: 0} delay: { show: 500, hide: 0}
}); });
}, },

View File

@ -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) { on_record_moved : function(record, old_group, old_index, new_group, new_index) {
var self = this; 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(); $(old_group.$el).add(new_group.$el).find('.oe_kanban_aggregates, .oe_kanban_group_length').hide();
if (old_group === new_group) { if (old_group === new_group) {
new_group.records.splice(old_index, 1); 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.$records.data('widget', this);
this.$has_been_started.resolve(); this.$has_been_started.resolve();
var add_btn = this.$el.find('.oe_kanban_add'); 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) { this.$records.find(".oe_kanban_column_cards").click(function (ev) {
if (ev.target == ev.currentTarget) { if (ev.target == ev.currentTarget) {
if (!self.state.folded) { 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]) return (new instance.web.Model(field.relation)).query([options.tooltip_on_group_by])
.filter([["id", "=", this.value]]).first().then(function(res) { .filter([["id", "=", this.value]]).first().then(function(res) {
self.tooltip = res[options.tooltip_on_group_by]; 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); 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) // If no draghandle is found, make the whole card as draghandle (provided one can edit)

View File

@ -29,7 +29,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
} }
}, self.options); }, self.options);
self.$el.sparkline(value, sparkline_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); }, 0);
}, },
}); });