1 _kiwi
.model
.PanelList
= Backbone
.Collection
.extend({
2 model
: _kiwi
.model
.Panel
,
4 comparator: function (chan
) {
5 return chan
.get("name");
7 initialize: function () {
8 this.view
= new _kiwi
.view
.Tabs({"el": $('#tabs')[0], "model": this});
10 // Automatically create a server tab
11 this.add(new _kiwi
.model
.Server({'name': _kiwi
.gateway
.get('name')}));
12 this.server
= this.getByName(_kiwi
.gateway
.get('name'));
14 // Holds the active panel
17 // Keep a tab on the active panel
18 this.bind('active', function (active_panel
) {
19 this.active
= active_panel
;
23 getByName: function (name
) {
24 if (typeof name
!== 'string') return;
25 return this.find(function (c
) {
26 return name
.toLowerCase() === c
.get('name').toLowerCase();