Add some et2_IDetachedDOM handling

This commit is contained in:
Nathan Gray 2011-09-14 20:52:59 +00:00
parent ff2a8102d6
commit 2302de28f2
3 changed files with 25 additions and 4 deletions

View File

@ -296,7 +296,7 @@ var et2_container = et2_baseWidget.extend({
/** /**
* Container object for not-yet supported widgets * Container object for not-yet supported widgets
*/ */
var et2_placeholder = et2_baseWidget.extend({ var et2_placeholder = et2_baseWidget.extend([et2_IDetachedDOM],{
init: function() { init: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -348,6 +348,18 @@ var et2_placeholder = et2_baseWidget.extend({
} }
this.setDOMNode(this.placeDiv[0]); this.setDOMNode(this.placeDiv[0]);
},
getDetachedAttributes: function(_attrs) {
_attrs.push("value");
},
getDetachedNodes: function() {
return [this.placeDiv[0]];
},
setDetachedAttributes: function(_nodes, _values) {
this.placeDiv = jQuery(_nodes[0]);
} }
}); });

View File

@ -649,7 +649,7 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], {
* by the calling code. * by the calling code.
*/ */
getDetachedAttributes: function(_attrs) { getDetachedAttributes: function(_attrs) {
_attrs.push("value"); _attrs.push("value", "class");
}, },
/** /**
@ -673,6 +673,12 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], {
setDetachedAttributes: function(_nodes, _values) { setDetachedAttributes: function(_nodes, _values) {
this.span = jQuery(_nodes[0]); this.span = jQuery(_nodes[0]);
this.set_value(_values["value"]); this.set_value(_values["value"]);
this._super.apply(this, arguments);
if(_values["class"])
{
this.span.addClass(_values["class"]);
}
} }

View File

@ -149,7 +149,7 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
*/ */
getDetachedAttributes: function(_attrs) { getDetachedAttributes: function(_attrs) {
_attrs.push("src", "label"); _attrs.push("src", "label", "href");
}, },
getDetachedNodes: function() { getDetachedNodes: function() {
@ -170,9 +170,12 @@ var et2_image = et2_baseWidget.extend(et2_IDetachedDOM, {
{ {
this.set_label(_values["label"]); this.set_label(_values["label"]);
} }
if(_values["href"])
{
this.image.addClass('et2_clickable');
}
} }
}); });
et2_register_widget(et2_image, ["image"]); et2_register_widget(et2_image, ["image"]);