making it librejs compliant
[KiwiIRC.git] / client / src / views / networktabs.js
CommitLineData
50ac472f
D
1// Model for this = _kiwi.model.NetworkPanelList
2_kiwi.view.NetworkTabs = Backbone.View.extend({
3 tagName: 'ul',
4 className: 'connections',
5
6 initialize: function() {
7 this.model.on('add', this.networkAdded, this);
8 this.model.on('remove', this.networkRemoved, this);
9
d199cacf 10 this.$el.appendTo(_kiwi.app.view.$el.find('.tabs'));
50ac472f
D
11 },
12
13 networkAdded: function(network) {
14 $('<li class="connection"></li>')
15 .append(network.panels.view.$el)
16 .appendTo(this.$el);
17 },
18
19 networkRemoved: function(network) {
12c3851e
D
20 // Remove the containing list element
21 network.panels.view.$el.parent().remove();
22
50ac472f
D
23 network.panels.view.remove();
24
25 _kiwi.app.view.doLayout();
26 }
27});