diff options
author | 2013-03-23 21:56:42 +0100 | |
---|---|---|
committer | 2013-03-23 21:56:42 +0100 | |
commit | 6e8a0f79f5ad7182a0bc35308ae06c63222667ed (patch) | |
tree | 0026179d34f19b64bc689c63af85b949ce57fb83 /module/web/static/js/views/notificationView.js | |
parent | show button when files are selected (diff) | |
download | pyload-6e8a0f79f5ad7182a0bc35308ae06c63222667ed.tar.xz |
implemented interactions for multi user, show waiting queries on webui
Diffstat (limited to 'module/web/static/js/views/notificationView.js')
-rw-r--r-- | module/web/static/js/views/notificationView.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/module/web/static/js/views/notificationView.js b/module/web/static/js/views/notificationView.js new file mode 100644 index 000000000..22c727304 --- /dev/null +++ b/module/web/static/js/views/notificationView.js @@ -0,0 +1,65 @@ +define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList'], + function($, Backbone, _, App, InteractionList) { + + // Renders context actions for selection packages and files + return Backbone.View.extend({ + el: '#notification-area', + template: _.compile($("#template-notification").html()), + + events: { + 'click .btn-query': 'openQuery', + 'click .btn-notification': 'openNotifications' + }, + + tasks: null, + // current open task + current: null, + // area is slided out + visible: false, + + initialize: function() { + this.tasks = new InteractionList(); + + this.$el.calculateHeight().height(0); + + App.vent.on('interaction:added', _.bind(this.onAdd, this)); + App.vent.on('interaction:deleted', _.bind(this.onDelete, this)); + + var render = _.bind(this.render, this); + this.listenTo(this.tasks, 'add', render); + this.listenTo(this.tasks, 'remove', render); + + }, + + onAdd: function(task) { + this.tasks.add(task); + }, + + onDelete: function(task) { + this.tasks.remove(task); + }, + + render: function() { + this.$el.html(this.template(this.tasks.toJSON())); + + if (this.tasks.length > 0 && !this.visible) { + this.$el.slideOut(); + this.visible = true; + } + else if (this.tasks.length === 0 && this.visible) { + this.$el.slideIn(); + this.visible = false; + } + + return this; + }, + + openQuery: function() { + + }, + + openNotifications: function() { + + } + }); + });
\ No newline at end of file |