summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/abstract/itemView.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/views/abstract/itemView.js')
-rw-r--r--module/web/static/js/views/abstract/itemView.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/module/web/static/js/views/abstract/itemView.js b/module/web/static/js/views/abstract/itemView.js
new file mode 100644
index 000000000..993764d3e
--- /dev/null
+++ b/module/web/static/js/views/abstract/itemView.js
@@ -0,0 +1,36 @@
+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.zapOut();
+ },
+
+ show: function() {
+ this.$el.zapIn();
+ },
+
+ load: function() {
+ this.model.fetch();
+ },
+
+ delete: function() {
+ this.model.destroy();
+ }
+
+ });
+}); \ No newline at end of file