From 15c13a8f4f73d032c28d2017f0d984b4104733e2 Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sat, 27 Dec 2014 00:09:01 -0300 Subject: [PATCH] fix popover not updated when updating notes --- mindplot/src/main/javascript/NoteIcon.js | 27 ++++++++++++------- .../src/main/javascript/widget/FloatingTip.js | 12 ++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/mindplot/src/main/javascript/NoteIcon.js b/mindplot/src/main/javascript/NoteIcon.js index 5954cec0..8f6ce064 100644 --- a/mindplot/src/main/javascript/NoteIcon.js +++ b/mindplot/src/main/javascript/NoteIcon.js @@ -44,7 +44,9 @@ mindplot.NoteIcon = new Class({ title: $msg('NOTE'), container: 'body', // Content can also be a function of the target element! - content: this._buildTooltipContent(), + content: function() { + return me._buildTooltipContent(); + }, html:true, placement:'bottom' }); @@ -52,16 +54,21 @@ mindplot.NoteIcon = new Class({ }, _buildTooltipContent: function() { - var result = $('
').css({padding:'5px'}); + if ($("body").find("#textPopoverNote").length == 1) { + var text = $("body").find("#textPopoverNote"); + text.text(this._linksModel.getText()); + } else { + var result = $('
').css({padding:'5px'}); - var text = $('
').text(this._linksModel.getText()) - .css({ - 'white-space':'pre-wrap', - 'word-wrap':'break-word' - } - ); - result.append(text); - return result; + var text = $('
').text(this._linksModel.getText()) + .css({ + 'white-space':'pre-wrap', + 'word-wrap':'break-word' + } + ); + result.append(text); + return result; + } }, getModel:function () { diff --git a/mindplot/src/main/javascript/widget/FloatingTip.js b/mindplot/src/main/javascript/widget/FloatingTip.js index c5aa02b7..2280c9a5 100644 --- a/mindplot/src/main/javascript/widget/FloatingTip.js +++ b/mindplot/src/main/javascript/widget/FloatingTip.js @@ -34,7 +34,17 @@ mindplot.widget.FloatingTip = new Class({ initialize: function (element, options) { this.setOptions(options); this.element = element; - element.popover(this.options); + this._createPopover(); + }, + + //FIXME: find a better way to do that... + _createPopover: function() { + this.element.popover(this.options); + var me = this; + this.element.one('hidden.bs.popover', function() { + me.element.popover('destroy'); + me._createPopover(); + }); }, show: function () {