Skip to content

Instantly share code, notes, and snippets.

@erichocean
Created October 8, 2008 00:36
Show Gist options
  • Save erichocean/15420 to your computer and use it in GitHub Desktop.
Save erichocean/15420 to your computer and use it in GitHub Desktop.
require('core');
require('models/message');
OI.messagesController = SC.ArrayController.create({
allowsEmptySelection: false,
allowsMultipleSelection: true,
contentBinding: 'OI.mailboxController.messages',
contentBindingDefault: SC.Binding.Multiple,
_isChanging: false,
selectionObserver: function() {
var sel = this.get('selection');
if (sel && sel.length == 1) {
sel[0].markAsRead();
}
}.observes('selection'),
// Enables dragging to mailboxes
collectionViewDragDataTypes: function(view) {
return [OI.MESSAGE_TYPE];
},
// Provide the actual message data for dragging
collectionViewDragDataForType: function(view, dataType, drag) {
return (dataType === OI.MESSAGE_TYPE) ? this.get('selection') : null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment