tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.61k stars 193 forks source link

Seeking documentation - what operators are allowed? #368

Closed stefek99 closed 9 years ago

stefek99 commented 9 years ago

I tried searching:

Found this presentation: http://oscarlodriguez.nl/Labs/htmlbars/#/8 image

But it doesn't tell me much about the syntax.

My current code:

<div class="flags {{if submission.approved 'hidden'}} {{if submission.rejected 'hidden'}}">

</div>

I want to add class hidden whenever submission has been approved or rejected.


I would like to know which operators works out of the box, what is the syntax and how to write own helpers as described here: http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional

salzhrani commented 9 years ago

Better use a computed property Ember.computed.or

mixonic commented 9 years ago

Or alternatively this excellent addon: https://github.com/jmurphyau/ember-truth-helpers

These helpers are not provided "out of the box", without an addon you would need to create a computed property. There are no immediate plans to add utility helpers like or, but we will be considering it later in the year.

This will be better documented as the Guides for ember are updated around 2.0. I'm closing this as I believe it is actually an issue with Ember's documentation, and unrelated to HTMLBars itself.

stefek99 commented 9 years ago

OK, thank you for letting me know.