Created
August 9, 2012 18:17
-
-
Save ahonor/3306761 to your computer and use it in GitHub Desktop.
getNodeAttributes.groovy
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
/** | |
* AJAX call used in the views, "/nodeType/{create,edit}.gsp" | |
*/ | |
def getNodeAttributes = { | |
def response = [] | |
def attrs = [] | |
if(params.templateid){ | |
def attributes = [] | |
Attribute.list().each() { | |
attributes += [id:it.id, name:it.name] | |
} | |
def atts = NodeAttribute.withCriteria { | |
eq("nodetype", params.templateid) | |
//order("name") | |
} | |
atts.each() { NodeAttribute na -> | |
attrs += [tid:na.nodetype.id,id:na.id, | |
val:na.attribute.name, datatype:na.attribute.filter.dataType]; | |
} | |
response += [attList:attributes, atts:attrs] | |
} | |
render response as JSON | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment