Allow "server and network" section to be collapsed once it's expanded
authorJack Allnutt <jack@allnutt.eu>
Tue, 16 Jul 2013 16:50:42 +0000 (17:50 +0100)
committerJack Allnutt <jack@allnutt.eu>
Tue, 16 Jul 2013 16:50:42 +0000 (17:50 +0100)
Fixes #330

client/assets/css/style.css
client/assets/src/index.html.tmpl
client/assets/src/views/serverselect.js

index d000f6a1b7a0b311f77951ae9b6ffde57238ab84..fb24c53c11926fb6c63eb9b06e21017b27df4e97 100644 (file)
@@ -762,7 +762,7 @@ html, body { height:100%; }
 #kiwi.theme_relaxed .server_select .basic tr.have_key { font-size:0.8em; }
 #kiwi.theme_relaxed .server_select .basic tr.channel td { padding-top:1em; }
 #kiwi.theme_relaxed .server_select .basic { border-bottom: 1px dashed gray; margin-bottom:1em; }
-#kiwi.theme_relaxed .server_select .basic .show_more { display: block; width:110px; margin:10px 0 0 0; font-size:0.8em; background: url(../img/more.png) no-repeat right 7px; }
+#kiwi.theme_relaxed .server_select .basic .show_more { display: block; width:110px; margin:10px 0 0 0; font-size:0.8em; }
 #kiwi.theme_relaxed .server_select.single_server .basic { border:none; }
 #kiwi.theme_relaxed .server_select .status { text-align: center; font-weight: bold; padding:1em; }
 #kiwi.theme_relaxed .server_select .status.ok { }
@@ -1275,7 +1275,7 @@ html, body { height:100%; }
 #kiwi.theme_cli .server_select .basic tr.have_pass { font-size:0.8em; }
 #kiwi.theme_cli .server_select .basic tr.channel td { padding-top:1em; }
 #kiwi.theme_cli .server_select .basic { border-bottom: 1px dashed gray; margin-bottom:1em; }
-#kiwi.theme_cli .server_select .basic .show_more { display: block; width:116px; margin:10px 0 0 0; font-size:0.8em; background: url(../img/more.png) no-repeat right 7px; }
+#kiwi.theme_cli .server_select .basic .show_more { display: block; width:116px; margin:10px 0 0 0; font-size:0.8em; }
 #kiwi.theme_cli .server_select.single_server .basic { border:none; }
 #kiwi.theme_cli .server_select .status { text-align: center; font-weight: bold; padding:1em; }
 #kiwi.theme_cli .server_select .status.ok { }
@@ -1592,7 +1592,7 @@ html, body { height:100%; }
 #kiwi.theme_basic .server_select .basic tr.have_pass { font-size:0.8em; }
 #kiwi.theme_basic .server_select .basic tr.channel td { padding-top:1em; }
 #kiwi.theme_basic .server_select .basic { border-bottom: 1px dashed gray; margin-bottom:1em; }
-#kiwi.theme_basic .server_select .basic .show_more { display: block; width:110px; margin:10px 0 0 0; font-size:0.8em; background: url(../img/more.png) no-repeat right 7px; }
+#kiwi.theme_basic .server_select .basic .show_more { display: block; width:110px; margin:10px 0 0 0; font-size:0.8em; }
 #kiwi.theme_basic .server_select.single_server .basic { border:none; }
 #kiwi.theme_basic .server_select .status { text-align: center; font-weight: bold; padding:1em; }
 #kiwi.theme_basic .server_select .status.ok { }
index 63038a4063a4173d91194e12e374e2d87fa1cbbd..a066513c465b305beacab1c8fe02a9df0d675e22 100644 (file)
                             </tr>\r
                         </table>\r
 \r
-                        <a href="" onclick="return false;" class="show_more">Server and network</a>\r
+                        <a href="" onclick="return false;" class="show_more">Server and network <i class="icon-caret-down"></i></a>\r
                     </div>\r
 \r
 \r
index eebdd6451f6b1cadec175e38142939dee5e5b2ab..f504b0c07eb642581157a6c2d3f10eef9ab90a4f 100644 (file)
@@ -24,6 +24,8 @@ _kiwi.view.ServerSelect = function () {
                 }
             }
 
+            this.more_shown = false;
+
             _kiwi.gateway.bind('onconnect', this.networkConnected, this);
             _kiwi.gateway.bind('connecting', this.networkConnecting, this);
             _kiwi.gateway.bind('onirc_error', this.onIrcError, this);
@@ -100,8 +102,23 @@ _kiwi.view.ServerSelect = function () {
         },
 
         showMore: function (event) {
-            $('.more', this.$el).slideDown('fast');
-            $('input.server', this.$el).select();
+            if (!this.more_shown) {
+                $('.more', this.$el).slideDown('fast');
+                $('.show_more', this.$el)
+                    .children('.icon-caret-down')
+                    .removeClass('icon-caret-down')
+                    .addClass('icon-caret-up');
+                $('input.server', this.$el).select();
+                this.more_shown = true;
+            } else {
+                $('.more', this.$el).slideUp('fast');
+                $('.show_more', this.$el)
+                    .children('.icon-caret-up')
+                    .removeClass('icon-caret-up')
+                    .addClass('icon-caret-down');
+                $('input.nick', this.$el).select();
+                this.more_shown = false;
+            }
         },
 
         populateFields: function (defaults) {