mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-10-06 10:12:46 +02:00
Fix %s in label of link widget
This commit is contained in:
parent
5c8c51c77d
commit
3816abc7a7
@ -911,18 +911,30 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
this.label_span = $j(document.createElement("label"))
|
||||||
|
.addClass("et2_label");
|
||||||
this.link = $j(document.createElement("span"))
|
this.link = $j(document.createElement("span"))
|
||||||
.addClass("et2_link");
|
.addClass("et2_link")
|
||||||
|
.appendTo(this.label_span);
|
||||||
|
|
||||||
if(this.options['class']) this.link.addClass(this.options['class']);
|
if(this.options['class']) this.label_span.addClass(this.options['class']);
|
||||||
this.setDOMNode(this.link[0]);
|
this.setDOMNode(this.label_span[0]);
|
||||||
},
|
},
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
if(this.link) this.link.unbind();
|
if(this.link) this.link.unbind();
|
||||||
this.link = null;
|
this.link = null;
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
set_label: function(label) {
|
||||||
|
// Remove current label
|
||||||
|
this.label_span.contents()
|
||||||
|
.filter(function(){ return this.nodeType == 3; }).remove();
|
||||||
|
|
||||||
|
var parts = et2_csvSplit(label, 2, "%s");
|
||||||
|
this.label_span.prepend(parts[0]);
|
||||||
|
this.label_span.append(parts[1]);
|
||||||
|
this.label = label;
|
||||||
|
},
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
if(typeof _value != 'object' && _value && !this.options.only_app)
|
if(typeof _value != 'object' && _value && !this.options.only_app)
|
||||||
{
|
{
|
||||||
@ -999,7 +1011,7 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
* passed to the "setDetachedAttributes" function in the same order.
|
* passed to the "setDetachedAttributes" function in the same order.
|
||||||
*/
|
*/
|
||||||
getDetachedNodes: function() {
|
getDetachedNodes: function() {
|
||||||
return [this.node, this._labelContainer ? this._labelContainer[0] : null];
|
return [this.node, this.link[0]];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1014,14 +1026,14 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
*/
|
*/
|
||||||
setDetachedAttributes: function(_nodes, _values) {
|
setDetachedAttributes: function(_nodes, _values) {
|
||||||
this.node = _nodes[0];
|
this.node = _nodes[0];
|
||||||
this.link = jQuery(_nodes[0]);
|
this.label_span = jQuery(_nodes[0]);
|
||||||
this._labelContainer = _nodes[1] != null ? jQuery(_nodes[1]) : null;
|
this.link = jQuery(_nodes[1]);
|
||||||
if(typeof _values["id"] !== "undefined") this.set_id(_values['id']);
|
if(typeof _values["id"] !== "undefined") this.set_id(_values['id']);
|
||||||
if(typeof _values["label"] !== "undefined") this.set_label(_values['label']);
|
if(typeof _values["label"] !== "undefined") this.set_label(_values['label']);
|
||||||
if(typeof _values["value"] !== "undefined" && typeof _values["value"].title !== "undefined")
|
if(typeof _values["value"] !== "undefined" && typeof _values["value"].title !== "undefined")
|
||||||
{
|
{
|
||||||
// Direct route
|
// Direct route
|
||||||
this.set_title(_nodes[0], _values["value"].title);
|
this.set_title(_nodes[1], _values["value"].title);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user