Client: Private `kiwi` namespace renamed to `_kiwi`
[KiwiIRC.git] / client / assets / dev / model_panellist.js
CommitLineData
eaaf73b0
D
1_kiwi.model.PanelList = Backbone.Collection.extend({\r
2 model: _kiwi.model.Panel,\r
9df70c63 3\r
9df70c63
D
4 comparator: function (chan) {\r
5 return chan.get("name");\r
6 },\r
7 initialize: function () {\r
eaaf73b0 8 this.view = new _kiwi.view.Tabs({"el": $('#tabs')[0], "model": this});\r
9df70c63
D
9\r
10 // Automatically create a server tab\r
eaaf73b0
D
11 this.add(new _kiwi.model.Server({'name': _kiwi.gateway.get('name')}));\r
12 this.server = this.getByName(_kiwi.gateway.get('name'));\r
9df70c63 13\r
85377d88
D
14 // Holds the active panel\r
15 this.active = null;\r
16\r
8b2a103d 17 // Keep a tab on the active panel\r
9df70c63
D
18 this.bind('active', function (active_panel) {\r
19 this.active = active_panel;\r
20 }, this);\r
21\r
22 },\r
23 getByName: function (name) {\r
24 if (typeof name !== 'string') return;\r
25 return this.find(function (c) {\r
26 return name.toLowerCase() === c.get('name').toLowerCase();\r
27 });\r
28 }\r
29});