-kiwi.model.PanelList = Backbone.Collection.extend({\r
- model: kiwi.model.Panel,\r
+_kiwi.model.PanelList = Backbone.Collection.extend({\r
+ model: _kiwi.model.Panel,\r
\r
comparator: function (chan) {\r
- return chan.get("name");\r
+ return chan.get('name');\r
},\r
- initialize: function () {\r
- this.view = new kiwi.view.Tabs({"el": $('#tabs')[0], "model": this});\r
+ initialize: function (elements, network) {\r
+ var that = this;\r
\r
- // Automatically create a server tab\r
- this.add(new kiwi.model.Server({'name': kiwi.gateway.get('name')}));\r
- this.server = this.getByName(kiwi.gateway.get('name'));\r
+ // If this PanelList is associated with a network/connection\r
+ if (network) {\r
+ this.network = network;\r
+ }\r
+\r
+ this.view = new _kiwi.view.Tabs({model: this});\r
\r
// Holds the active panel\r
this.active = null;\r
this.active = active_panel;\r
}, this);\r
\r
+ this.bind('add', function(panel) {\r
+ panel.set('panel_list', this);\r
+ });\r
+ },\r
+\r
+\r
+\r
+ getByCid: function (cid) {\r
+ if (typeof name !== 'string') return;\r
+\r
+ return this.find(function (c) {\r
+ return cid === c.cid;\r
+ });\r
},\r
+\r
+\r
+\r
getByName: function (name) {\r
if (typeof name !== 'string') return;\r
+\r
return this.find(function (c) {\r
return name.toLowerCase() === c.get('name').toLowerCase();\r
});\r
}\r
-});
\ No newline at end of file
+});\r