From 16fabc82277a5ff77271a17078865d0c7ea4bf70 Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Thu, 28 May 2020 11:03:05 +0000 Subject: [REF] web: allow override tooltip options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the options of the tooltip where set inline. After this commit, the options are returned by a function. This allow us to adapt these options in another module. Task ID: 2152124 closes odoo/odoo#52170 Related: odoo/enterprise#10864 Signed-off-by: Adrien Dieudonné (adr) --- .../static/src/js/views/basic/basic_renderer.js | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_renderer.js') diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js index 3d5c14e0b10..322b284a742 100644 --- a/addons/web/static/src/js/views/basic/basic_renderer.js +++ b/addons/web/static/src/js/views/basic/basic_renderer.js @@ -280,14 +280,7 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, { // should be attached if not given, the tooltip is attached on the // widget's $el $node = $node.length ? $node : widget.$el; - $node.tooltip({ - title: function () { - return qweb.render('WidgetLabel.tooltip', { - debug: config.isDebug(), - widget: widget, - }); - } - }); + $node.tooltip(this._getTooltipOptions(widget)); }, /** * Does the necessary DOM updates to match the given modifiers data. The @@ -413,6 +406,22 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, { _getRecord: function (recordId) { return null; }, + /** + * Get the options for the tooltip. This allow to change this options in another module. + * @param widget + * @return {{}} + * @private + */ + _getTooltipOptions: function (widget) { + return { + title: function () { + return qweb.render('WidgetLabel.tooltip', { + debug: config.isDebug(), + widget: widget, + }); + } + }; + }, /** * @private * @param {jQueryElement} $el -- cgit v1.2.3