summaryrefslogtreecommitdiffstats
path: root/module/web/app/scripts/views/abstract/itemView.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/app/scripts/views/abstract/itemView.js')
-rw-r--r--module/web/app/scripts/views/abstract/itemView.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/module/web/app/scripts/views/abstract/itemView.js b/module/web/app/scripts/views/abstract/itemView.js
new file mode 100644
index 000000000..394044ec4
--- /dev/null
+++ b/module/web/app/scripts/views/abstract/itemView.js
@@ -0,0 +1,46 @@
+define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) {
+
+ // A view that is meant for temporary displaying
+ // All events must be unbound in onDestroy
+ return Backbone.View.extend({
+
+ tagName: 'li',
+ destroy: function() {
+ this.undelegateEvents();
+ this.unbind();
+ if (this.onDestroy) {
+ this.onDestroy();
+ }
+ this.$el.removeData().unbind();
+ this.remove();
+ },
+
+ hide: function() {
+ this.$el.slideUp();
+ },
+
+ show: function() {
+ this.$el.slideDown();
+ },
+
+ unrender: function() {
+ var self = this;
+ this.$el.slideUp(function() {
+ self.destroy();
+ });
+ },
+
+ deleteItem: function(e) {
+ if (e)
+ e.stopPropagation();
+ this.model.destroy();
+ },
+
+ restart: function(e) {
+ if(e)
+ e.stopPropagation();
+ this.model.restart();
+ }
+
+ });
+}); \ No newline at end of file