Skip to content

Instantly share code, notes, and snippets.

@patrick-steele-idem
Created July 16, 2012 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save patrick-steele-idem/3125854 to your computer and use it in GitHub Desktop.
Save patrick-steele-idem/3125854 to your computer and use it in GitHub Desktop.
"Logic-less" versus "More logic"
<!-- "LOGIC-LESS": -->
{{#cartEmpty}}
<div>
Your shopping cart is empty!
</div>
{{/cartEmpty}}
{{#cartNotEmpty}}
<ul>
{{cartItems}}
<li>
{{> cartItem}}
</li>
{{//cartItems}}
</ul>
{{/cartNotEmpty}}
<!-- MORE LOGIC: -->
<div c:if="cart.isEmpty()">
Your shopping cart is empty!
</div>
<ul c:if="!cart.isEmpty()">
<li c:for="item in cart.getItems()">
<c:include template="cartItem" data="item"/>
</li>
</ul>
<!-- EVEN MORE LOGIC: -->
<c:choose>
<div c:when="cart.isEmpty()">
Your shopping cart is empty!
</div>
<ul c:otherwise="">
<li c:for="item in cart.getItems()">
<c:include template="cartItem" data="item"/>
</li>
</ul>
</c:choose>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment