Skip to content

Instantly share code, notes, and snippets.

@mattd
Created January 23, 2013 19:22
Show Gist options
  • Save mattd/4611848 to your computer and use it in GitHub Desktop.
Save mattd/4611848 to your computer and use it in GitHub Desktop.
define([
'underscore',
'marionette',
'vent',
'views/mixins/resizable',
'views/group/collection/item'
], function (
_,
Marionette,
vent,
ResizableViewMixin,
GroupCollectionItemView
) {
"use strict";
var GroupCollectionView = Marionette.CollectionView.extend({
initialize: function (options) {
options = options || {};
if (options) {
this.parentGroupGuid = options.parentGroupGuid;
}
this.collection.listenTo(vent, 'group:created', function (model) {
if (model.get('parent_group_guid') === this.parentGroupGuid) {
this.add(model);
}
}, this);
},
onClose: function () {
this.collection.stopListening();
},
itemView: GroupCollectionItemView,
tagName: 'ul'
});
return _.extend(GroupCollectionView.prototype, ResizableViewMixin);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment