fix popover not updated when updating notes

This commit is contained in:
Ezequiel Bergamaschi 2014-12-27 00:09:01 -03:00
parent 2d513f5c85
commit 4732b13196
2 changed files with 28 additions and 11 deletions

View File

@ -44,7 +44,9 @@ mindplot.NoteIcon = new Class({
title: $msg('NOTE'), title: $msg('NOTE'),
container: 'body', container: 'body',
// Content can also be a function of the target element! // Content can also be a function of the target element!
content: this._buildTooltipContent(), content: function() {
return me._buildTooltipContent();
},
html:true, html:true,
placement:'bottom' placement:'bottom'
}); });
@ -52,7 +54,11 @@ mindplot.NoteIcon = new Class({
}, },
_buildTooltipContent: function() { _buildTooltipContent: function() {
var result = $('<div></div>').css({padding:'5px'}); if ($("body").find("#textPopoverNote").length == 1) {
var text = $("body").find("#textPopoverNote");
text.text(this._linksModel.getText());
} else {
var result = $('<div id="textPopoverNote"></div>').css({padding:'5px'});
var text = $('<div></div>').text(this._linksModel.getText()) var text = $('<div></div>').text(this._linksModel.getText())
.css({ .css({
@ -62,6 +68,7 @@ mindplot.NoteIcon = new Class({
); );
result.append(text); result.append(text);
return result; return result;
}
}, },
getModel:function () { getModel:function () {

View File

@ -34,7 +34,17 @@ mindplot.widget.FloatingTip = new Class({
initialize: function (element, options) { initialize: function (element, options) {
this.setOptions(options); this.setOptions(options);
this.element = element; 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 () { show: function () {