model_networkpanellist extracted to its own file
authorDarren <darren@Darrens-MacBook-Pro.local>
Sat, 27 Apr 2013 18:01:58 +0000 (19:01 +0100)
committerDarren <darren@Darrens-MacBook-Pro.local>
Sat, 27 Apr 2013 18:01:58 +0000 (19:01 +0100)
client/assets/dev/build.js
client/assets/dev/index.html.tmpl
client/assets/dev/model_networkpanellist.js [new file with mode: 0644]
client/assets/dev/model_panellist.js

index 723db1656eee41ad571e43e85e781b8b670457a4..8adba49e5a647088538ac523bf458c89cf4bd275 100644 (file)
@@ -37,6 +37,7 @@ var src = concat([
     __dirname + '/model_memberlist.js',\r
     __dirname + '/model_panel.js',\r
     __dirname + '/model_panellist.js',\r
+    __dirname + '/model_networkpanellist.js',\r
     __dirname + '/model_query.js',\r
     __dirname + '/model_channel.js',\r
     __dirname + '/model_server.js',\r
index bff13ff8d2852df246cb5f5f80781ab0c72fa408..40cd32e08685dd1d418d112b53a61bde3a1f4213 100644 (file)
                 </ul>\r
             </div>\r
 \r
-            <div id="tabs">\r
-                <ul class="panellist channels"></ul>\r
-                <ul class="panellist applets"></ul>\r
-            </div>\r
+            <div id="tabs"></div>\r
 \r
             <div id="topic">\r
                 <div contenteditable="true"></div>\r
                 ],\r
                 [\r
                     'dev/model_panellist.js',\r
+                    'dev/model_networkpanellist.js',\r
                     'dev/model_panel.js',\r
                     'dev/model_member.js',\r
                     'dev/model_memberlist.js'\r
diff --git a/client/assets/dev/model_networkpanellist.js b/client/assets/dev/model_networkpanellist.js
new file mode 100644 (file)
index 0000000..96785c3
--- /dev/null
@@ -0,0 +1,62 @@
+_kiwi.model.NetworkPanelList = Backbone.Collection.extend({
+    model: _kiwi.model.Network,
+
+    initialize: function() {
+        this.view = new _kiwi.view.NetworkTabs({model: this});
+        
+        this.on('add', this.onNetworkAdd, this);
+        this.on('remove', this.onNetworkRemove, this);
+
+        // Current active connection / panel
+        this.active_connection = undefined;
+        this.active_panel = undefined;
+
+        // TODO: Remove this - legacy
+        this.active = undefined;
+    },
+
+    getByConnectionId: function(id) {
+        return this.find(function(connection){
+            return connection.get('connection_id') == id;
+        });
+    },
+
+    panels: function() {
+        var panels = [];
+
+        this.each(function(network) {
+            panels = panels.concat(network.panels.models);
+        });
+
+        return panels;
+    },
+
+
+    onNetworkAdd: function(network) {
+        network.panels.on('active', this.onPanelActive, this);
+
+        // if it's our first connection, set it active
+        if (this.models.length === 1) {
+            this.active_connection = network;
+            this.active_panel = network.panels.server;
+
+            // TODO: Remove this - legacy
+            this.active = this.active_panel;
+        }
+    },
+
+    onNetworkRemove: function(network) {
+        network.panels.off('active', this.onPanelActive, this);
+    },
+
+    onPanelActive: function(panel) {
+        var connection = this.getByConnectionId(panel.tab.data('connection_id'));
+        this.trigger('active', panel, connection);
+
+        this.active_connection = connection;
+        this.active_panel = panel;
+
+        // TODO: Remove this - legacy
+        this.active = panel;
+    }
+});
\ No newline at end of file
index 39d1a1afe9a6aa8a059e715940e373fa12bbf65d..b1050fd0b4678d796561ccead18ce539a91f2325 100644 (file)
@@ -37,68 +37,3 @@ _kiwi.model.PanelList = Backbone.Collection.extend({
         });\r
     }\r
 });\r
-\r
-\r
-\r
-_kiwi.model.NetworkPanelList = Backbone.Collection.extend({\r
-    model: _kiwi.model.Network,\r
-\r
-    initialize: function() {\r
-        this.view = new _kiwi.view.NetworkTabs({model: this});\r
-        \r
-        this.on('add', this.onNetworkAdd, this);\r
-        this.on('remove', this.onNetworkRemove, this);\r
-\r
-        // Current active connection / panel\r
-        this.active_connection = undefined;\r
-        this.active_panel = undefined;\r
-\r
-        // TODO: Remove this - legacy\r
-        this.active = undefined;\r
-    },\r
-\r
-    getByConnectionId: function(id) {\r
-        return this.find(function(connection){\r
-            return connection.get('connection_id') == id;\r
-        });\r
-    },\r
-\r
-    panels: function() {\r
-        var panels = [];\r
-\r
-        this.each(function(network) {\r
-            panels = panels.concat(network.panels.models);\r
-        });\r
-\r
-        return panels;\r
-    },\r
-\r
-\r
-    onNetworkAdd: function(network) {\r
-        network.panels.on('active', this.onPanelActive, this);\r
-\r
-        // if it's our first connection, set it active\r
-        if (this.models.length === 1) {\r
-            this.active_connection = network;\r
-            this.active_panel = network.panels.server;\r
-\r
-            // TODO: Remove this - legacy\r
-            this.active = this.active_panel;\r
-        }\r
-    },\r
-\r
-    onNetworkRemove: function(network) {\r
-        network.panels.off('active', this.onPanelActive, this);\r
-    },\r
-\r
-    onPanelActive: function(panel) {\r
-        var connection = this.getByConnectionId(panel.tab.data('connection_id'));\r
-        this.trigger('active', panel, connection);\r
-\r
-        this.active_connection = connection;\r
-        this.active_panel = panel;\r
-\r
-        // TODO: Remove this - legacy\r
-        this.active = panel;\r
-    }\r
-});
\ No newline at end of file