\r
initialize: (options) ->\r
@body = options.body\r
+ @collection = []\r
_this = this\r
- @file_items = @collection().fetch({}).done(() -> _this.render())\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
+ _this.render()\r
\r
render: () ->\r
_this = this\r
- _.each @collection().models, (item) ->\r
- c = _this.file_item_class()\r
- file_item = new c({'file_body': _this, 'item': item})\r
- args = {'file_body': _this}\r
- template = _.template($("#" + file_item.template_name()).html())\r
- _this.$el.append(template(args))\r
+ this.$el.html('')\r
+ _.each @collection, (file_item) ->\r
+ _this.$el.append(file_item.render().el)\r
this\r
\r
file_item_class: () ->\r
model: () ->\r
@filer().model\r
\r
- collection: () ->\r
- @filer().collection\r
+ items: () ->\r
+ @filer().items\r
\r
template_dir: () ->\r
@filer().template_dir\r