Created
September 30, 2011 15:11
-
-
Save Eugeny/1254039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Button magic --> | |
<xsl:template match="button"> | |
<xsl:variable name="onclickjs"> | |
<xsl:choose> | |
<xsl:when test="@warning != ''"> | |
return Ajenti.showWarning('<xsl:value-of select="@warning"/>', | |
'<xsl:value-of select="@id"/>'); | |
</xsl:when> | |
<xsl:when test="@onclick = 'form'"> | |
return ajaxForm('<xsl:value-of select="@form" />', | |
'<xsl:value-of select="@action" />'); | |
</xsl:when> | |
<xsl:when test="@onclick = 'off'"></xsl:when> | |
<xsl:when test="not(@onclick)"> | |
return ajax('/handle/<xsl:value-of | |
select="x:attr(@class, 'button')" />/click/<xsl:value-of | |
select="@id" />'); | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="@onclick" /> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<xsl:variable name="design"> | |
<xsl:choose> | |
<xsl:when test="@design != ''"> | |
<xsl:value-of select="@design" /> | |
</xsl:when> | |
<xsl:otherwise> | |
default | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<a href="{@href}" onclick="{$onclickjs}" class="ui-el-button btn {$design}"> | |
<xsl:if test="@icon"> | |
<img src="{@icon}" /> | |
</xsl:if> | |
<xsl:value-of select="@text" /> | |
</a> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment