-
Notifications
You must be signed in to change notification settings - Fork 337
Description
The syntax for implementing simple comparisons is overly complex and I think there should be simpler method for adding simple comparisons to your template code.
For example, in jquery.tmpl, you could do:
<div class="base{{if varName == 'None'}} none{{/if}}">${varName}</div>
However, this simple comparison is much more difficult in the new engine. First, you've got to set:
$.views.allowCode = true;
And then your template ends up looking something like this:
<div class="base{{* if($view.data.varName == 'None'){ result += ' none'; } }}">{{=varName}}</div>
This is quite a bit more complicated to implement and much more difficult to interpret.
Any chance of being able to implement something like:
<div class="base{{#if equals(varName, 'None')}} none{{/if}}">{{=varName}}</div>
Where we have some functional helpers like equals(), not(), gt(), lt(), gte(), lte()--and with the potential to define more helper functions.
I can understand dropping to code view for more complex operations, but it seems like there should be a way to at least perform some simple comparisons w/out having to drop to the overly complex code syntax.