relaxed theme panellist styling
[KiwiIRC.git] / client / src / views / rightbar.js
CommitLineData
626c1246 1_kiwi.view.RightBar = Backbone.View.extend({
06d56c90
D
2 events: {
3 'click .right-bar-toggle': 'onClickToggle',
4 'click .right-bar-toggle-inner': 'onClickToggle'
5 },
6
626c1246
D
7 initialize: function() {
8 this.keep_hidden = false;
06d56c90
D
9 this.hidden = this.$el.hasClass('disabled');
10
11 this.updateIcon();
626c1246
D
12 },
13
14
15 hide: function() {
16 this.hidden = true;
17 this.$el.addClass('disabled');
06d56c90
D
18
19 this.updateIcon();
626c1246
D
20 },
21
22
23 show: function() {
24 this.hidden = false;
25
26 if (!this.keep_hidden)
27 this.$el.removeClass('disabled');
06d56c90
D
28
29 this.updateIcon();
626c1246
D
30 },
31
32
33 // Toggle if the rightbar should be shown or not
34 toggle: function() {
35 this.keep_hidden = !this.keep_hidden;
36
37 if (this.keep_hidden || this.hidden) {
38 this.$el.addClass('disabled');
39 } else {
40 this.$el.removeClass('disabled');
41 }
06d56c90
D
42
43 this.updateIcon();
44 },
45
46
47 updateIcon: function() {
48 var $toggle = this.$('.right-bar-toggle'),
49 $icon = $toggle.find('i');
50
51 if (!this.hidden && this.keep_hidden) {
52 $toggle.show();
53 } else {
54 $toggle.hide();
55 }
56
57 if (this.keep_hidden) {
58 $icon.removeClass('icon-double-angle-right').addClass('icon-user');
59 } else {
60 $icon.removeClass('icon-user').addClass('icon-double-angle-right');
61 }
62 },
63
64
65 onClickToggle: function(event) {
66 this.toggle();
67 _kiwi.app.view.doLayout();
626c1246
D
68 }
69});