jrough
11/25/2014 7:04:00 PM
On Tuesday, November 25, 2014 10:35:33 AM UTC-8, Chris Riesbeck wrote:
> On 11/25/2014 12:10 PM, JRough wrote:
> > I need to change the mustache code. Basically if a web page is on a certain tab then it adds the class="current" to the <li>. I need it to skip one tab call activity-tab. How would I do this?
> > <ul>
> > {{# each tab}}
> > <li class="{{#if isCurrent}}current{{/if}}" id="{{id}}" test-event="{{id}}" tabindex="1">
> > <h4 >{{name}}</h4>
> > </li>
> > {{/each}}
> >
> > ---------------------------Something like---------------
> >
> > {{# each tab}}
> > <li class="{{#if isCurrent && !== "activity-tab"}}current{{/if}}" id="{{id}}" test-event="{{id}}" tabindex="1">
> > <h4 >{{name}}</h4>
> > </li>
> > {{/each}}
> >
> > thanks,
> >
> Mustache tries to be as logic-less as possible, to keep the HTML
> uncluttered. The logic should be in the JavaScript that creates the data
> you feed to Mustache. Change your JavaScript to create a data model that
> has the desired class for each tab in it, then in the template, just
> iterate over the tabs and insert the class.
I can't change the data model because I need the tab on the page otherwise I don't have a page but on that page I don't want the list. Isn't there a helper function?