comparator: function (chan) {\r
return chan.get('name');\r
},\r
- initialize: function () {\r
- this.view = new _kiwi.view.Tabs({el: $('#tabs')[0], model: this});\r
+ initialize: function (network) {\r
+\r
+ // The network this PanelList is associated with\r
+ this.network = network;\r
+\r
+ this.view = new _kiwi.view.Tabs({model: this});\r
\r
// Automatically create a server tab\r
var server_panel = new _kiwi.model.Server({name: 'Server'});\r
\r
// Model for this = _kiwi.model.PanelList\r
_kiwi.view.Tabs = Backbone.View.extend({\r
+ tagName: 'ul',\r
+\r
events: {\r
'click li': 'tabClick',\r
'click li .part': 'partClick'\r
this.tabs_applets = $('ul.applets', this.$el);\r
this.tabs_msg = $('ul.channels', this.$el);\r
\r
- _kiwi.gateway.on('change:name', function (gateway, new_val) {\r
+ this.model.network.on('change:name', function (network, new_val) {\r
$('span', this.model.server.tab).text(new_val);\r
}, this);\r
+\r
+ $('#kiwi .panellist.channels').append(this.$el);\r
},\r
+\r
render: function () {\r
var that = this;\r
\r
\r
// Add the server tab first\r
this.model.server.tab\r
- .data('panel_id', this.model.server.cid)\r
+ .data('panel', this.model.server)\r
.appendTo(this.tabs_msg);\r
\r
// Go through each panel adding its tab\r
if (panel == that.model.server) return;\r
\r
panel.tab\r
- .data('panel_id', panel.cid)\r
- .appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
+ .data('panel', panel)\r
+ .appendTo(that.$el);\r
+ //.appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
});\r
\r
_kiwi.app.view.doLayout();\r
panel.tab.addClass('server');\r
}\r
\r
- panel.tab.data('panel_id', panel.cid)\r
- .appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
+ panel.tab.data('panel', panel)\r
+ .appendTo(this.$el);\r
+ //.appendTo(panel.isApplet() ? this.tabs_applets : this.tabs_msg);\r
\r
panel.bind('change:title', this.updateTabTitle);\r
_kiwi.app.view.doLayout();\r
\r
tabClick: function (e) {\r
var tab = $(e.currentTarget);\r
-\r
- var panel = this.model.getByCid(tab.data('panel_id'));\r
+ \r
+ var panel = tab.data('panel');\r
if (!panel) {\r
// A panel wasn't found for this tab... wadda fuck\r
return;\r
\r
partClick: function (e) {\r
var tab = $(e.currentTarget).parent();\r
- var panel = this.model.getByCid(tab.data('panel_id'));\r
+ var panel = this.model.getByCid(tab.data('panel'));\r
\r
// Only need to part if it's a channel\r
// If the nicklist is empty, we haven't joined the channel as yet\r
if (panel.isChannel() && panel.get('members').models.length > 0) {\r
- _kiwi.gateway.part(panel.get('name'));\r
+ this.model.network.gateway.part(panel.get('name'));\r
} else {\r
panel.close();\r
}\r