diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-23 21:04:47 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-23 21:04:47 +0200 |
commit | f370ef06ad9db2e47edba02b99271137324997cf (patch) | |
tree | d432ea10ee77fc9a4165c685eefe9afd1714fcbf /module/web/static/js/views/packageView.js | |
parent | fixed the dashboard (diff) | |
download | pyload-f370ef06ad9db2e47edba02b99271137324997cf.tar.xz |
added some animations, code for show/hiding items
Diffstat (limited to 'module/web/static/js/views/packageView.js')
-rw-r--r-- | module/web/static/js/views/packageView.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/module/web/static/js/views/packageView.js b/module/web/static/js/views/packageView.js index 171325d1f..1fbcd0613 100644 --- a/module/web/static/js/views/packageView.js +++ b/module/web/static/js/views/packageView.js @@ -1,24 +1,30 @@ -define(['jquery', 'backbone', 'underscore', 'views/fileView', 'utils/lazyRequire'], - function($, Backbone, _, fileView, lazyLoader) { +define(['jquery', 'views/abstract/itemView', 'underscore', 'views/fileView', 'utils/lazyRequire'], + function($, itemView, _, fileView, lazyLoader) { // Renders a single package item - return Backbone.View.extend({ + return itemView.extend({ tagName: 'li', events: { 'click .load': 'load', 'click .delete': 'delete', - 'click .show-dialog': 'show' + '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($('<a class="load" href="#"> Load</a>')); @@ -36,18 +42,13 @@ define(['jquery', 'backbone', 'underscore', 'views/fileView', 'utils/lazyRequire }, unrender: function() { - this.$el.remove(); - }, - - load: function() { - this.model.fetch(); - }, - - delete: function() { - this.model.destroy(); + var self = this; + this.$el.zapOut(function() { + self.destroy(); + }); }, - show: function() { + show_dialog: function() { var self = this; this.requireOnce(['views/modal/modalView'], function(modalView){ if (self.modal === null) |