Not submitting serverselection form if already in progress
authorDarren <darren@darrenwhitlen.com>
Tue, 2 Oct 2012 16:56:42 +0000 (17:56 +0100)
committerDarren <darren@darrenwhitlen.com>
Tue, 2 Oct 2012 16:56:42 +0000 (17:56 +0100)
client_backbone/dev/view.js

index 277eebb1417b7e0d012419dac19365ba76d6c357..087528596063d32cd199bc958e85fd11935ab60a 100755 (executable)
@@ -108,6 +108,8 @@ kiwi.view.ServerSelect = function () {
             kiwi.gateway.bind('connecting', this.networkConnecting, this);\r
 \r
             kiwi.gateway.bind('onirc_error', function (data) {\r
+                $('button', this.$el).attr('disabled', null);\r
+\r
                 if (data.error == 'nickname_in_use') {\r
                     this.setStatus('Nickname already taken');\r
                     this.show('nick_change');\r
@@ -122,10 +124,14 @@ kiwi.view.ServerSelect = function () {
                 this.submitLogin(event);\r
             }\r
 \r
+            $('button', this.$el).attr('disabled', 1);\r
             return false;\r
         },\r
 \r
         submitLogin: function (event) {\r
+            // If submitting is disabled, don't do anything\r
+            if ($('button', this.$el).attr('disabled')) return;\r
+            \r
             var values = {\r
                 nick: $('.nick', this.$el).val(),\r
                 server: $('.server', this.$el).val(),\r
@@ -213,6 +219,7 @@ kiwi.view.ServerSelect = function () {
 \r
         showError: function (event) {\r
             this.setStatus('Error connecting', 'error');\r
+            $('button', this.$el).attr('disabled', null);\r
             this.show();\r
         }\r
     });\r