summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorKhoi Nguyen <bng@odoo.com>2017-07-23 16:09:18 +0200
committerKhoi Nguyen <bng@odoo.com>2017-07-24 13:14:23 +0200
commit952c17b8a76c39f6bdf780edcd07ca5def3c8520 (patch)
tree68abba882908c2b8f026f9b5742de06e336d06c7 /addons/web/static/src/js
parentcae497b6794ec8b9dd44c986660106ae28b332ba (diff)
[FIX] web: add tooltips for buttons
Button tooltips have been missing since the switch to the new views. As their omission was unintentional, this revision restores the functionality.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/form/form_renderer.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js
index 25b72e4fb5a..75d3fcebf1d 100644
--- a/addons/web/static/src/js/views/form/form_renderer.js
+++ b/addons/web/static/src/js/views/form/form_renderer.js
@@ -336,12 +336,27 @@ var FormRenderer = BasicRenderer.extend({
* @returns {jQueryElement}
*/
_renderHeaderButton: function (node) {
+ var self = this;
var $button = $('<button>')
.text(node.attrs.string)
.addClass('btn btn-sm btn-default');
this._addOnClickAction($button, node);
this._handleAttributes($button, node);
this._registerModifiers(node, this.state, $button);
+
+ // Display tooltip
+ if (config.debug || node.attrs.help) {
+ $button.tooltip({
+ delay: { show: 1000, hide: 0 },
+ title: function () {
+ return qweb.render('WidgetButton.tooltip', {
+ debug: config.debug,
+ state: self.state,
+ node: node,
+ });
+ },
+ });
+ }
return $button;
},
/**