Created
February 21, 2011 19:59
-
-
Save nithril/837614 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
class UICompositionTagLib { | |
static namespace = 'ui' | |
def out | |
def composition = { attrs, body -> | |
if (!attrs.template) { | |
throwTagError("Tag [composition] is missing required attribute [template]") | |
} | |
Composition composition = new Composition() | |
body(composition) | |
out << g.render(template: attrs.template, model: composition.defines) | |
} | |
def define = { attrs, body -> | |
if (!attrs.composition) { | |
throwTagError("Tag [define] is missing required attribute [composition]") | |
} | |
if (!attrs.name) { | |
throwTagError("Tag [define] is missing required attribute [name]") | |
} | |
attrs.composition.defines.put(attrs.name, body) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment