Make hover_action available for none detached description

This commit is contained in:
Hadi Nategh 2018-12-07 11:16:14 +01:00
parent 4bf653515a
commit 80fb0315d4

View File

@ -235,6 +235,11 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
this.span[0], this.span[0],
this.options.href ? this.options.extra_link_target : '_blank' this.options.href ? this.options.extra_link_target : '_blank'
); );
// Add hover action button (Edit)
if (this.options.hover_action)
{
this._build_hover_action();
}
if(this.options.extra_link_popup || this.options.mime) if(this.options.extra_link_popup || this.options.mime)
{ {
var href = this.options.href; var href = this.options.href;
@ -328,12 +333,22 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
_nodes[0].setAttribute("class", _values["class"]); _nodes[0].setAttribute("class", _values["class"]);
} }
// Add hover action button (Edit) // Add hover action button (Edit), _data is nm's row data
if (this.options.hover_action) if (this.options.hover_action)
{ {
var content = _data.content; this._build_hover_action(_data);
}
},
/**
* Builds button for hover action
* @param {object} _data
*/
_build_hover_action: function(_data)
{
var content = _data && _data.content ? _data.content: undefined;
var widget = this; var widget = this;
this.span.on('mouseenter', jQuery.proxy(function(event) { this.span.off().on('mouseenter', jQuery.proxy(function(event) {
event.stopImmediatePropagation(); event.stopImmediatePropagation();
var self = this; var self = this;
this.span.tooltip({ this.span.tooltip({
@ -363,7 +378,6 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
.tooltip("open"); .tooltip("open");
}, {widget: this, span: this.span})); }, {widget: this, span: this.span}));
} }
}
}));}).call(this); }));}).call(this);
et2_register_widget(et2_description, ["description", "label"]); et2_register_widget(et2_description, ["description", "label"]);