From: Darren Date: Sun, 25 May 2014 13:17:06 +0000 (+0100) Subject: 100% width nick list on small screens X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=95d37c14bc8972b4ae28faa5791dd039bc870bb7;p=KiwiIRC.git 100% width nick list on small screens --- diff --git a/client/assets/themes/relaxed/style.css b/client/assets/themes/relaxed/style.css index 47f73de..167e182 100644 --- a/client/assets/themes/relaxed/style.css +++ b/client/assets/themes/relaxed/style.css @@ -188,7 +188,9 @@ background-color: #DADADA; border-left: 1px solid #8A8A8A; } -#kiwi.narrow .right_bar { display:none; } +#kiwi.narrow .right_bar { width:100%; } +#kiwi.narrow .right_bar.disabled { width:0; } + #kiwi .memberlists ul { list-style: none; } #kiwi .memberlists ul.active { } #kiwi .memberlists ul li { padding: 0.2em 1em; } diff --git a/client/src/views/application.js b/client/src/views/application.js index 6564cd6..d3d4d31 100644 --- a/client/src/views/application.js +++ b/client/src/views/application.js @@ -169,10 +169,14 @@ _kiwi.view.Application = Backbone.View.extend({ } // Determine if we have a narrow window (mobile/tablet/or even small desktop window) - if (el_kiwi.outerWidth() < 400) { + if (el_kiwi.outerWidth() < 420) { el_kiwi.addClass('narrow'); + if (this.model.rightbar && this.model.rightbar.keep_hidden !== true) + this.model.rightbar.toggle(true); } else { el_kiwi.removeClass('narrow'); + if (this.model.rightbar && this.model.rightbar.keep_hidden !== false) + this.model.rightbar.toggle(false); } // Set the panels width depending on the memberlist visibility diff --git a/client/src/views/rightbar.js b/client/src/views/rightbar.js index 1f1b4ed..6647bdc 100644 --- a/client/src/views/rightbar.js +++ b/client/src/views/rightbar.js @@ -31,8 +31,16 @@ _kiwi.view.RightBar = Backbone.View.extend({ // Toggle if the rightbar should be shown or not - toggle: function() { - this.keep_hidden = !this.keep_hidden; + toggle: function(keep_hidden) { + // Hacky, but we need to ignore the toggle() call from doLayout() as we are overriding it + if (this.ignore_layout) + return true; + + if (typeof keep_hidden === 'undefined') { + this.keep_hidden = !this.keep_hidden; + } else { + this.keep_hidden = keep_hidden; + } if (this.keep_hidden || this.hidden) { this.$el.addClass('disabled'); @@ -64,6 +72,12 @@ _kiwi.view.RightBar = Backbone.View.extend({ onClickToggle: function(event) { this.toggle(); + + // Hacky, but we need to ignore the toggle() call from doLayout() as we are overriding it + this.ignore_layout = true; _kiwi.app.view.doLayout(); + + // No longer ignoring the toggle() call from doLayout() + delete this.ignore_layout; } }); \ No newline at end of file