Created
June 25, 2014 19:48
-
-
Save digilord/d9bfcb473cc3cef673f4 to your computer and use it in GitHub Desktop.
Block Helper Example
This file contains 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
<template name='testing'> | |
{{#myOuterBlockHelper mydata='SOMETHING'}} | |
{{#myInnerBlockHelper1}}helper 1!{{/myInnerBlockHelper1}} | |
{{else}} | |
<h1> Some static Content </h1> | |
{{/myOuterBlockHelper}} | |
</template> | |
<template name='_myOuterBlockHelper'> | |
{{#if mydata}} | |
{{> UI.contentBlock}} | |
{{else}} | |
{{> UI.elseBlock}} | |
{{/if}} | |
</template> | |
<template name='_myInnerBlockHelper1'> | |
{{#if mydata}} | |
{{> UI.contentBlock}} | |
{{else}} | |
{{> UI.elseBlock}} | |
{{/if}} | |
</template> | |
=========== | |
UI.registerHelper 'myOuterBlockHelper', () -> | |
console.log this | |
# Determine what data you want to do for the else | |
this.mydata = 'SOMETHING PASSED IN' | |
return Template._myOuterBlockHelper | |
UI.registerHelper 'myInnerBlockHelper1', () -> | |
console.log this | |
# Determine what data you want to do for the else | |
return Template._myInnerBlockHelper1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment