Created
February 6, 2012 21:31
-
-
Save danharper/1755024 to your computer and use it in GitHub Desktop.
Handlebars Conditional Helper
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
Handlebars.registerHelper('if_task_active', function(options) { | |
var state = this.model.state_id; | |
if (state == 300) { | |
return options.fn(this); | |
} | |
return options.inverse(this); | |
}); |
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
{{#if_task_active}} | |
<span class="highlight">Task is active.</span> | |
{{else}} | |
<span>Task is pending.</span> | |
{{/if_task_active}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment