mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Add hover_action for detached description widget
This commit is contained in:
parent
69f91de4a7
commit
b7582fa9a0
@ -164,7 +164,7 @@ var et2_nextmatch_rowProvider = (function(){ "use strict"; return ClassWithAttri
|
||||
entry.widget.transformAttributes.call(entry.widget,data);
|
||||
|
||||
// Call the setDetachedAttributes function
|
||||
entry.widget.setDetachedAttributes(nodes, data);
|
||||
entry.widget.setDetachedAttributes(nodes, data, _data);
|
||||
}
|
||||
|
||||
// Insert the row into the tr
|
||||
|
@ -93,7 +93,14 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
|
||||
type: "string",
|
||||
default: '',
|
||||
description: "hash for data stored on service-side with egw_link::(get|set)_data()"
|
||||
},
|
||||
hover_action: {
|
||||
"name": "hover action",
|
||||
"type": "js",
|
||||
"default": et2_no_init,
|
||||
"description": "JS code which is executed when clicking on action button. This action is explicitly for attached nodes, like in nm."
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
legacyOptions: ["font_style", "href", "activate_links", "for",
|
||||
@ -300,7 +307,7 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
|
||||
return [this.span[0]];
|
||||
},
|
||||
|
||||
setDetachedAttributes: function(_nodes, _values)
|
||||
setDetachedAttributes: function(_nodes, _values, _data)
|
||||
{
|
||||
// Update the properties
|
||||
var updateLink = false;
|
||||
@ -320,6 +327,42 @@ var et2_description = (function(){ "use strict"; return expose(et2_baseWidget.ex
|
||||
{
|
||||
_nodes[0].setAttribute("class", _values["class"]);
|
||||
}
|
||||
|
||||
// Add hover action button (Edit)
|
||||
if (this.options.hover_action)
|
||||
{
|
||||
var content = _data.content;
|
||||
var widget = this;
|
||||
this.span.on('mouseenter', jQuery.proxy(function(event) {
|
||||
event.stopImmediatePropagation();
|
||||
var self = this;
|
||||
this.span.tooltip({
|
||||
items: 'span.et2_label',
|
||||
position: {my:"right top", at:"left top", collision:"flipfit"},
|
||||
tooltipClass: "et2_email_popup",
|
||||
content: function()
|
||||
{
|
||||
return jQuery('<a href="#" class= "et2_url_email_contactPlus" title="'+egw.lang('Edit')+'"><img src="'
|
||||
+egw.image("edit") +'"/></a>')
|
||||
.on('click', function() {
|
||||
widget.options.hover_action.call(self, self.widget, content);
|
||||
});
|
||||
},
|
||||
close: function( event, ui )
|
||||
{
|
||||
ui.tooltip.hover(
|
||||
function () {
|
||||
jQuery(this).stop(true).fadeTo(400, 1);
|
||||
},
|
||||
function () {
|
||||
jQuery(this).fadeOut("400", function(){ jQuery(this).remove();});
|
||||
}
|
||||
);
|
||||
}
|
||||
})
|
||||
.tooltip("open");
|
||||
}, {widget: this, span: this.span}));
|
||||
}
|
||||
}
|
||||
}));}).call(this);
|
||||
et2_register_widget(et2_description, ["description", "label"]);
|
||||
|
Loading…
Reference in New Issue
Block a user