diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-05-01 18:09:40 +0300 |
---|---|---|
committer | Benaka <diosmosis@users.noreply.github.com> | 2018-05-01 18:09:40 +0300 |
commit | 9eff672aae8e0289190757f4b47dd5627df00fd2 (patch) | |
tree | 56119444b9d38ffd45d99bf9e09601cdbffb1f63 /plugins/CoreHome/angularjs/widget/widget.directive.js | |
parent | 0e7f6e24ad104f653876f9d4680071b1a258debe (diff) |
Automatically initialize title tooltips after loading a report (#12800)
* Automatically initialize title tooltips after loading a report
* destroy tooltips upon scope destroy
* avoid tooltip
Diffstat (limited to 'plugins/CoreHome/angularjs/widget/widget.directive.js')
-rw-r--r-- | plugins/CoreHome/angularjs/widget/widget.directive.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/CoreHome/angularjs/widget/widget.directive.js b/plugins/CoreHome/angularjs/widget/widget.directive.js index 8f2bd2e25d..45a12031a0 100644 --- a/plugins/CoreHome/angularjs/widget/widget.directive.js +++ b/plugins/CoreHome/angularjs/widget/widget.directive.js @@ -96,6 +96,25 @@ } else if (attrs.containerid) { findContainerWidget(attrs.containerid, scope); } + + $(element).tooltip({ + track: true, + content: function() { + var title = $(this).attr('title'); + return piwikHelper.escape(title.replace(/\n/g, '<br />')); + }, + show: false, + hide: false + }); + + scope.$on( + "$destroy", + function () { + try { + $(element).tooltip('destroy'); + } catch (e) {} + } + ); } } }; |