Skip to content

Instantly share code, notes, and snippets.

@digilord
Created June 25, 2014 19:48
Show Gist options
  • Save digilord/d9bfcb473cc3cef673f4 to your computer and use it in GitHub Desktop.
Save digilord/d9bfcb473cc3cef673f4 to your computer and use it in GitHub Desktop.
Block Helper Example
<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