Added support for the 'class' attribute

This commit is contained in:
Andreas Stöckel 2011-08-22 11:16:37 +00:00
parent 0d78091fe5
commit 1db6a7aaf5
3 changed files with 37 additions and 2 deletions

View File

@ -64,6 +64,12 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode, {
"type": "dimension", "type": "dimension",
"default": et2_no_init, "default": et2_no_init,
"description": "Height of the element in pixels, percentage or 'auto'" "description": "Height of the element in pixels, percentage or 'auto'"
},
"class": {
"name": "CSS Class",
"type": "string",
"default": et2_no_init,
"description": "CSS Class which is applied to the dom element of this node"
} }
}, },
@ -244,6 +250,20 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode, {
{ {
$j(node).css("height", _value); $j(node).css("height", _value);
} }
},
set_class: function(_value) {
var node = this.getDOMNode(this);
if (node)
{
if (this["class"])
{
$j(node).removeClass(this["class"]);
}
$j(node).addClass(_value);
}
this["class"] = _value;
} }
}); });

View File

@ -92,8 +92,6 @@ var et2_description = et2_baseWidget.extend({
this.span.attr("for", this.options.label_for); this.span.attr("for", this.options.label_for);
} }
// Create an array which contains the parts of the text with links around
// it
et2_insertLinkText(this._parseText(), this.span[0], this.options.extra_link_target); et2_insertLinkText(this._parseText(), this.span[0], this.options.extra_link_target);
this.setDOMNode(this.span[0]); this.setDOMNode(this.span[0]);

View File

@ -5,6 +5,23 @@
<description value="This is only a test" font_style="italic" statustext="This is only an italic label!"/> <description value="This is only a test" font_style="italic" statustext="This is only an italic label!"/>
<description value="Welcome to http://www.egroupware.org/, if you have any question feel free to write a mail to mailto:info@egroupware.org" activate_links="true" /> <description value="Welcome to http://www.egroupware.org/, if you have any question feel free to write a mail to mailto:info@egroupware.org" activate_links="true" />
<description value="Go to the EGroupware homepage" href="http://www.egroupware.org/" extra_link_target="_popup"/> <description value="Go to the EGroupware homepage" href="http://www.egroupware.org/" extra_link_target="_popup"/>
<description class="eyecancer" value="Amazing!"/>
</vbox> </vbox>
<styles>
.eyecancer {
font-size: 18pt;
color: red;
text-shadow: 0 0 10px red;
text-decoration: blink;
border: 5px groove red;
padding: 10px;
width: 120px;
text-align: center;
display: inline-block;
border-radius: 25px;
-moz-border-radius: 25px;
margin: 30px;
}
</styles>
</overlay> </overlay>