\r
initialize: (options) ->\r
@body = options.body\r
- @collection = []\r
+ @file_items = []\r
_this = this\r
c = @filer().collection\r
c.fetch().done ->\r
- _this.filer().items = c.models\r
- _this.collection = _.map c.models, (item) ->\r
- c = _this.file_item_class()\r
- new c({'file_body': _this, 'item': item})\r
+ items = if c['singular'] # type of model?\r
+ [c]\r
+ else\r
+ c.models\r
+ _this.file_items = _.map items, (item) ->\r
+ fi = _this.file_item_class()\r
+ new fi({'file_body': _this, 'item': item})\r
_this.render()\r
\r
render: () ->\r
_this = this\r
this.$el.html('')\r
- _.each @collection, (file_item) ->\r
+ _.each @file_items, (file_item) ->\r
_this.$el.append(file_item.render().el)\r
this\r
\r