Skip to content

Instantly share code, notes, and snippets.

@StevenLangbroek
Last active August 29, 2015 13:56
Show Gist options
  • Save StevenLangbroek/8937119 to your computer and use it in GitHub Desktop.
Save StevenLangbroek/8937119 to your computer and use it in GitHub Desktop.
TemplateHelpers
<script type="text/handlebars" id="my_list_template">
<div class="{{whichuser}}">
<img src="{{ image }}">
<div class="message_body">
{{{message_body}}}
</div>
</div>
</script>
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