Server connection dialog extracted
authorDarren <darren@Darrens-MacBook-Pro.local>
Mon, 29 Apr 2013 15:48:21 +0000 (16:48 +0100)
committerDarren <darren@Darrens-MacBook-Pro.local>
Mon, 29 Apr 2013 15:48:21 +0000 (16:48 +0100)
client/assets/css/style.css
client/assets/dev/index.html.tmpl
client/assets/dev/model_application.js
client/assets/dev/model_gateway.js
client/assets/dev/model_network.js
client/assets/dev/model_newconnection.js
client/assets/dev/view.js

index 46556ce9792c517bdcaef9c6062f31e3901fc028..eab6fe06418784722f398396c83cc36747854e61 100644 (file)
@@ -165,7 +165,7 @@ html, body { height:100%; }
 /**
  * Server selection dialog
  */
-#kiwi .server_select { width:800px; margin:0 auto; overflow:hidden; }
+#kiwi .server_select { width:320px; margin:0 auto; overflow:hidden; }
 #kiwi .server_select .more { display: none; }
 #kiwi .server_select button {  }
 #kiwi .server_select input { }
@@ -564,7 +564,7 @@ html, body { height:100%; }
 
 
 /* The server select dialog */
-#kiwi.theme_relaxed .server_select { width:730px;  padding:3em 0 2em 0; margin: 0 auto; }
+#kiwi.theme_relaxed .server_select { padding:3em 0 2em 0; }
 #kiwi.theme_relaxed .server_select .more { display: none; width:270px; margin:0 auto; }
 #kiwi.theme_relaxed .server_select table tr td { padding:5px; }
 #kiwi.theme_relaxed .server_select button { float:right; padding:3px 7px; }
@@ -587,13 +587,13 @@ html, body { height:100%; }
 }
 
 
-#kiwi.theme_relaxed .server_select .kiwi_logo { text-align: center; display:block; }
-#kiwi.theme_relaxed .server_select .kiwi_logo h1 {
-    font-size:20px;
-    line-height:48px; vertical-align: middle;
+#kiwi.theme_relaxed .server_select .kiwi_logo { text-align: center; display:block; margin-top:30px; }
+#kiwi.theme_relaxed .server_select .kiwi_logo h1 span {
+    font-size:14px;
+    line-height:24px; vertical-align: middle;
     color: #555555;
 }
-#kiwi.theme_relaxed .server_select .kiwi_logo img { }
+#kiwi.theme_relaxed .server_select .kiwi_logo img { display:inline; width:24px; }
 
 
 #kiwi.theme_relaxed.chanlist_treeview #panels { left:160px; }
index 4b34b5845da3497e725f93d8f05edd9fb7a3f47a..b677774342b48ca9de97a88d13b6fffaf215389b 100644 (file)
                     </div>\r
                 </form>\r
 \r
-                <div class="divider-verticle"></div>\r
-            </div>\r
-\r
-            <div class="about_kiwi" style="position:relative;float:left;width:320px;margin-left:3em;color:#555555;">\r
                 <a class="kiwi_logo" href="https://kiwiirc.com/" target="_blank">\r
-                    <img src="<%base_path%>/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /> <br />\r
-                    <h1>Powered by Kiwi IRC</h1>\r
+                    <h1><span>Powered by Kiwi IRC</span> <img src="/kiwi/assets/img/ico.png" alt="KiwiIRC Logo" title="Kiwi IRC" /></h1>\r
                 </a>\r
-\r
-                <p style="font-style:italic;">A <strong>hand-crafted IRC client</strong> that you can enjoy. Designed to be used <strong>easily</strong> and <strong>freely</strong>.</p>\r
-\r
-                <p style="font-size:0.9em;margin-top:2em;">Peek at the <a href="https://kiwiirc.com/">Kiwi IRC homepage</a> for more information or to find out how to embed it on your own website. Looking for source code? Try the <a href="http://github.com/prawnsalad/KiwiIRC/">GitHub</a> page. This network of people may not be associated with Kiwi IRC itself.</p>\r
             </div>\r
         </div>\r
     </script>\r
index f884c2b4847729fae84c9d29a08e3b1d25150823..98933074fadcd090738141d31c943ff6c4d66894 100644 (file)
@@ -73,17 +73,8 @@ _kiwi.model.Application = function () {
             var connection_dialog = new _kiwi.model.NewConnection();\r
             this.populateDefaultServerSettings(connection_dialog);\r
 \r
-            var m = new _kiwi.view.MenuBox();\r
-            m.showFooter(false);\r
-            m.closeOnBlur(false);\r
-            m.addItem('new_connection', connection_dialog.view.$el);\r
-            m.show();\r
-\r
-            // Center the connection dialog\r
-            m.$el.addClass('first');\r
-            m.$el.offset({\r
-                left: (this.view.$el.width() / 2) - (m.$el.width() / 2)\r
-            });\r
+            connection_dialog.view.$el.addClass('initial');\r
+            this.view.$el.find('.panel_container:first').append(connection_dialog.view.$el);\r
 \r
             // TODO: Shouldn't really be here but it's not working in the view.. :/\r
             // Hack for firefox browers: Focus is not given on this event loop iteration\r
@@ -93,8 +84,11 @@ _kiwi.model.Application = function () {
 \r
             // Once connected, close this dialog and remove its own event\r
             var fn = function() {\r
-                connection_dialog.view.$el.slideUp('fast', function() {\r
-                    m.dispose();\r
+                connection_dialog.view.$el.slideUp(function() {\r
+                    console.log('disposing connectio dialog');\r
+                    connection_dialog.view.dispose();\r
+                    connection_dialog = null;\r
+\r
                     _kiwi.gateway.off('onconnect', fn);\r
                 });\r
 \r
index 0cf09fb7ed6cf946896d377e0c23646ebe1dbdfb..1ec9350110acb240281632f8432209681e0166ae 100644 (file)
@@ -342,7 +342,6 @@ _kiwi.model.Gateway = function () {
             server: _kiwi.app.connections.active_connection.get('connection_id'),\r
             data: JSON.stringify(data)\r
         };\r
-        \r
         this.socket.emit('irc', data_buffer, callback);\r
     };\r
 \r
@@ -568,7 +567,7 @@ _kiwi.model.Gateway = function () {
         }\r
 \r
         return false;\r
-    }\r
+    };\r
 \r
 \r
     return new (Backbone.Model.extend(this))(arguments);\r
index 9bc709bf5f423404adfa7cd5d308fdf3e163273b..0a0301b6e284a818977034eb76de05236d4b64b1 100644 (file)
@@ -53,9 +53,7 @@
         bindGatewayEvents: function () {
             //this.gateway.on('all', function() {console.log('ALL', this.get('connection_id'), arguments);});
 
-            this.gateway.on('connect', function(event) {
-                this.set('nick', event.nick);
-            }, this);
+            this.gateway.on('connect', onConnect, this);
 
             this.gateway.on('nick', function(event) {
                 if (event.nick === this.get('nick')) {
 
 
 
+    function onConnect(event) {
+        this.set('nick', event.nick);
+
+        if (this.auto_join && this.auto_join.channel) {
+            this.gateway.join(this.auto_join.channel, this.auto_join.channel_key);
+        }
+    }
+
+
+
     function onOptions(event) {
         var that = this;
 
index 3c8cf78a84e9eb788fdc0ea1a3410509c2bdce9c..368f8bf60f0f286cad351f42119549fbef6d4fc9 100644 (file)
@@ -48,6 +48,8 @@ _kiwi.model.NewConnection = Backbone.Collection.extend({
     makeConnection: function(new_connection_event) {
         var that = this;
 
+        this.connect_details = new_connection_event;
+
         _kiwi.gateway.newConnection({
             nick: new_connection_event.nick,
             host: new_connection_event.server,
@@ -61,6 +63,14 @@ _kiwi.model.NewConnection = Backbone.Collection.extend({
 
 
     onNewNetwork: function(err, network) {
+        if (network && this.connect_details) {
+            network.auto_join = {
+                channel: this.connect_details.channel,
+                key: this.connect_details.channel_key
+            };
+        }
+
+
         // Show the server panel if this is our first network
         if (network && network.get('connection_id') === 0) {
             network.panels.server.view.show();
index 428ff5a91e7a300d82585ca97933b79c43be81ba..4fc6f9e7bb563a9909e0dd82321528c1c57b1aa5 100644 (file)
@@ -197,6 +197,8 @@ _kiwi.view.ServerSelect = function () {
             _kiwi.gateway.off('onconnect', this.networkConnected, this);\r
             _kiwi.gateway.off('connecting', this.networkConnecting, this);\r
             _kiwi.gateway.off('onirc_error', this.onIrcError, this);\r
+\r
+            this.$el.remove();\r
         },\r
 \r
         submitForm: function (event) {\r
@@ -349,7 +351,8 @@ _kiwi.view.ServerSelect = function () {
 \r
 _kiwi.view.Panel = Backbone.View.extend({\r
     tagName: "div",\r
-    className: "messages",\r
+    className: "panel messages",\r
+\r
     events: {\r
         "click .chan": "chanClick",\r
         'click .media .open': 'mediaClick',\r
@@ -573,7 +576,7 @@ _kiwi.view.Panel = Backbone.View.extend({
         var $this = this.$el;\r
 \r
         // Hide all other panels and show this one\r
-        this.$container.children().css('display', 'none');\r
+        this.$container.children('.panel').css('display', 'none');\r
         $this.css('display', 'block');\r
 \r
         // Show this panels memberlist\r