define(['jquery', 'views/abstract/itemView', 'underscore', 'views/fileView', 'utils/lazyRequire'], function($, itemView, _, fileView, lazyLoader) { // Renders a single package item return itemView.extend({ tagName: 'li', events: { 'click .load': 'load', 'click .delete': 'delete', 'click .show-dialog': 'show_dialog' }, modal: null, requireOnce: lazyLoader.once(), initialize: function() { this.model.on('filter:added', this.hide, this); this.model.on('filter:removed', this.show, this); this.model.on('change', this.render, this); this.model.on('remove', this.unrender, this); }, onDestroy: function() { this.modal.off('filter:added', this.hide); // TODO }, render: function() { this.$el.html('Package ' + this.model.get('pid') + ': ' + this.model.get('name')); this.$el.append($(' Load')); this.$el.append($(' Delete')); this.$el.append($(' Show')); if (this.model.isLoaded()) { var ul = $('