100% width nick list on small screens
authorDarren <darren@darrenwhitlen.com>
Sun, 25 May 2014 13:17:06 +0000 (14:17 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 25 May 2014 13:17:06 +0000 (14:17 +0100)
client/assets/themes/relaxed/style.css
client/src/views/application.js
client/src/views/rightbar.js

index 47f73de4580edb080a21dbe58106d626f978b429..167e1826c8f3ec21daf5f658c3ee133b97ce4b99 100644 (file)
     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; }
index 6564cd64c4491c83d71c76d333a7785b4700eb42..d3d4d3172f69226a2dc3449a863d162741ce69c0 100644 (file)
@@ -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
index 1f1b4ed335efbb74fb9c7dc4e84e30be2899621a..6647bdcbd6ec7404750d201e5555258bd0c68c48 100644 (file)
@@ -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