1 _kiwi
.view
.RightBar
= Backbone
.View
.extend({
3 'click .right-bar-toggle': 'onClickToggle',
4 'click .right-bar-toggle-inner': 'onClickToggle'
7 initialize: function() {
8 this.keep_hidden
= false;
9 this.hidden
= this.$el
.hasClass('disabled');
17 this.$el
.addClass('disabled');
26 if (!this.keep_hidden
)
27 this.$el
.removeClass('disabled');
33 // Toggle if the rightbar should be shown or not
34 toggle: function(keep_hidden
) {
35 // Hacky, but we need to ignore the toggle() call from doLayout() as we are overriding it
36 if (this.ignore_layout
)
39 if (typeof keep_hidden
=== 'undefined') {
40 this.keep_hidden
= !this.keep_hidden
;
42 this.keep_hidden
= keep_hidden
;
45 if (this.keep_hidden
|| this.hidden
) {
46 this.$el
.addClass('disabled');
48 this.$el
.removeClass('disabled');
55 updateIcon: function() {
56 var $toggle
= this.$('.right-bar-toggle'),
57 $icon
= $toggle
.find('i');
59 if (!this.hidden
&& this.keep_hidden
) {
65 if (this.keep_hidden
) {
66 $icon
.removeClass('fa fa-angle-double-right').addClass('fa fa-users');
68 $icon
.removeClass('fa fa-users').addClass('fa fa-angle-double-right');
73 onClickToggle: function(event
) {
76 // Hacky, but we need to ignore the toggle() call from doLayout() as we are overriding it
77 this.ignore_layout
= true;
78 _kiwi
.app
.view
.doLayout();
80 // No longer ignoring the toggle() call from doLayout()
81 delete this.ignore_layout
;