Say I have a base template – let’s call it “shell” that provides me with 3 divs (top,left,main). In my top div I am appending a nav bar view. The nav bar view has a “log in” link that I want to change to a “log out” when the user is logged in. Is this best done with logic in the template or would it be suggested to instead make these separate views and if so, where do I best handle the display logic? I’m pretty sure this is the only instance where I will need to do this kind of thing. Thanks for any help.
Share
Six of one and a half dozen of the other. Even if you put the logic in your template, that template is still going to need you to pass it a flag indicating whether it’s in “logged in” or “logged out” mode, and where’s that flag going to have to come from (if you’re doing standard Backbone)? A view.
So really your question strikes me as essentially being a choice between something like:
or:
Based on your comment that:
I would recommend not bothering with the template logic, just because … why bother? But ultimately there’s no wrong answer.