Skip to content

Instantly share code, notes, and snippets.

@gmoeck
Forked from drnic/app.handlebars
Created June 4, 2011 20:36
Show Gist options
  • Save gmoeck/1008335 to your computer and use it in GitHub Desktop.
Save gmoeck/1008335 to your computer and use it in GitHub Desktop.
{{#view id="messages" isVisibleBinding="App.noticesListController.isEmpty"}}
{{#collection App.NoticeCollectionView }}
{{content.body}}
<a class="hide">Dismiss</a>
{{/collection}}
{{/view}}
App.noticesListController = SC.ArrayController.create({
// Initialize the array controller with an empty array.
content: [],
isEmpty: function() {
return this.getPath('content.length') == 0;
}.property('content.length').cacheable()
});
App.NoticeCollectionView = SC.TemplateCollectionView.extend({
contentBinding: 'App.noticesListController',
tagName: 'div',
classNames: ['message', 'notices'],
itemView: SC.TemplateView.extend({
tagName: 'p',
classNames: ['notice'],
mouseDown: function(evt) {
var notice = this.get('content');
notice.destroy();
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment