c814960c0376cd8130027071c41d6bfbf9d24f2f
[KiwiIRC.git] / client / src / views / networktabs.js
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
10 this.$el.appendTo(_kiwi.app.view.$el.find('.tabs'));
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) {
20 // Remove the containing list element
21 network.panels.view.$el.parent().remove();
22
23 network.panels.view.remove();
24
25 _kiwi.app.view.doLayout();
26 }
27 });