Last active
August 29, 2015 13:56
-
-
Save StevenLangbroek/8937119 to your computer and use it in GitHub Desktop.
TemplateHelpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/handlebars" id="my_list_template"> | |
<div class="{{whichuser}}"> | |
<img src="{{ image }}"> | |
<div class="message_body"> | |
{{{message_body}}} | |
</div> | |
</div> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message extends Marionette.ItemView | |
template: '#my_item_template' | |
templateHelpers: => | |
whichUser: => | |
if App.currentUser.id == @model.get('author') | |
'self' | |
else | |
'other' | |
class ListMessages extends Marionette.CompositeView | |
template: '#my_list_template' | |
itemView: Message | |
itemViewContainer: 'ul' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment