ControlInput updating nick view properly
[KiwiIRC.git] / client / assets / dev / model_panellist.js
1 _kiwi.model.PanelList = Backbone.Collection.extend({
2 model: _kiwi.model.Panel,
3
4 comparator: function (chan) {
5 return chan.get('name');
6 },
7 initialize: function (elements, network) {
8 var that = this;
9
10 // If this PanelList is associated with a network/connection
11 if (network) {
12 this.network = network;
13 }
14
15 this.view = new _kiwi.view.Tabs({model: this});
16
17 // Holds the active panel
18 this.active = null;
19
20 // Keep a tab on the active panel
21 this.bind('active', function (active_panel) {
22 this.active = active_panel;
23 }, this);
24
25 this.bind('add', function(panel) {
26 panel.set('panel_list', this);
27 });
28 },
29
30
31
32 getByName: function (name) {
33 if (typeof name !== 'string') return;
34
35 return this.find(function (c) {
36 return name.toLowerCase() === c.get('name').toLowerCase();
37 });
38 }
39 });