From b18fa59e40ebe9c03f81d49cf53a85bc728de8a7 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 23 Dec 2012 20:10:01 +0100 Subject: proper selecting, expanding and rendering of packageViews --- module/web/static/js/views/fileView.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'module/web/static/js/views/fileView.js') diff --git a/module/web/static/js/views/fileView.js b/module/web/static/js/views/fileView.js index f020a69d4..7e8f899a9 100644 --- a/module/web/static/js/views/fileView.js +++ b/module/web/static/js/views/fileView.js @@ -1,7 +1,8 @@ -define(['jquery', 'backbone', 'underscore', 'app'], function($, Backbone, _, App) { +define(['jquery', 'backbone', 'underscore', 'app', 'views/abstract/itemView'], + function($, Backbone, _, App, ItemView) { // Renders single file item - return Backbone.View.extend({ + return ItemView.extend({ tagName: 'li', className: 'file-view', @@ -12,6 +13,13 @@ define(['jquery', 'backbone', 'underscore', 'app'], function($, Backbone, _, App }, initialize: function() { + this.model.on('change', this.render, this); + this.model.on('remove', this.destroy, this); + }, + + onDestroy: function() { + this.model.off('change', this.render); + this.model.off('remove', this.destroy); }, render: function() { -- cgit v1.2.3