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();