Extracting the right_bar into its own view with toggling logic
[KiwiIRC.git] / client / src / views / rightbar.js
1 _kiwi.view.RightBar = Backbone.View.extend({
2 initialize: function() {
3 this.keep_hidden = false;
4 this.hidden = false;
5 },
6
7
8 hide: function() {
9 this.hidden = true;
10 this.$el.addClass('disabled');
11 },
12
13
14 show: function() {
15 this.hidden = false;
16
17 if (!this.keep_hidden)
18 this.$el.removeClass('disabled');
19 },
20
21
22 // Toggle if the rightbar should be shown or not
23 toggle: function() {
24 this.keep_hidden = !this.keep_hidden;
25
26 if (this.keep_hidden || this.hidden) {
27 this.$el.addClass('disabled');
28 } else {
29 this.$el.removeClass('disabled');
30 }
31 }
32 });