Only open 1 query panel per user from userbox
authorDarren <darren@darrenwhitlen.com>
Thu, 3 Jul 2014 22:40:17 +0000 (23:40 +0100)
committerDarren <darren@darrenwhitlen.com>
Thu, 3 Jul 2014 22:40:17 +0000 (23:40 +0100)
client/src/views/userbox.js

index 8d21445a97ca9c8be394d98d5e273538293c76f5..8494629e1a7ecd4b5f05de9931c9d61868af0fd1 100644 (file)
@@ -44,8 +44,14 @@ _kiwi.view.UserBox = Backbone.View.extend({
     },
 
     queryClick: function (event) {
-        var panel = new _kiwi.model.Query({name: this.user.get('nick')});
-        _kiwi.app.connections.active_connection.panels.add(panel);
+        var nick = this.user.get('nick'),
+            panel = _kiwi.app.connections.active_connection.panels.getByName(nick);
+
+        if (!panel) {
+            panel = new _kiwi.model.Query({name: nick});
+            _kiwi.app.connections.active_connection.panels.add(panel);
+        }
+
         panel.view.show();
     },