Skip to content

Instantly share code, notes, and snippets.

@bootleg224
Last active May 6, 2022 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootleg224/e52cd913473f07b804dc10b45db0b008 to your computer and use it in GitHub Desktop.
Save bootleg224/e52cd913473f07b804dc10b45db0b008 to your computer and use it in GitHub Desktop.
{{!This is a Comment -- You can use Comments much like // or ' in other programming languages}}
<strong>Conditional Examples:</strong><br/>
{{!if something has a value}}
{{#if submissionForm.managerSEmail}}
Manager Email: {{submissionForm.managerSEmail}}
{{else}}
Manager Email is Empty
{{/if}}
<hr/>
{{!unless something has a value}}
{{#unless submissionForm.doNotContactManager}}
Contact the Manager
{{else}}
Do not Contact the Manager
{{/unless}}
<hr/>
{{!ifCond allows for equals, not equals, greater than, less than}}
{{!ifCond aliasOrValue "operator" aliasOrValue}}
{{!Operators are ==, !=, >, >=, <, <=}}
{{#ifCond (tableLength submissionForm.favoriteMenuItems) "==" 1}}
One Rows in Table
{{else}}
{{tableLength submissionForm.favoriteMenuItems}} Rows in Table
{{/ifCond}}
<hr/>
{{#ifCond (tableLength submissionForm.favoriteMenuItems) "!=" 1}}
Some Value other than 1 Row in Table
{{/ifCond}}
<hr/>
{{!Shortcut notation exists eq for ==; notEq for !=}}
{{!Shortcut notation exists for gt for >, gte for >=, lt for <, lte for <=}}
{{#eq (tableLength submissionForm.favoriteMenuItems 1)}}
One Rows in Table
{{else}}
{{tableLength submissionForm.favoriteMenuItems}} Rows in Table
{{/eq}}
<hr/>
{{#notEq (tableLength submissionForm.favoriteMenuItems) 1}}
Some Value other than 1 Row in Table
{{/notEq}}
<hr/>
{{#ifCond (tableLength submissionForm.favoriteMenuItems) ">" 1}}
Table Length is Greater Than 1
{{/ifCond}}
<hr/>
{{#gt (tableLength submissionForm.favoriteMenuItems) 1}}
Table Length is Greater Than 1
{{/gt}}
<hr/>
{{!AND, OR, NOT}}
{{#and (eq (tableLength submissionForm.favoriteMenuItems) 3) (eq submissionForm.title "McDonald's")}}
Both True
{{else}}
At Least Once False
{{/and}}
<hr/>
{{#or (eq (tableLength submissionForm.favoriteMenuItems) 0) (eq submissionForm.title "McDonald's")}}
At Least One True
{{else}}
Both False
{{/or}}
<hr/>
{{!Not with preview of next chapter}}
{{#not (contains submissionForm.managerSEmail "@")}}
No @ in Email
{{else}}
Email is OK
{{/not}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment