From b6b2d3db0c1130eea0d74c827789fee185de2954 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Fri, 21 Sep 2012 21:50:43 +0100 Subject: [PATCH] Progress on Issue #78: If nick is taken, show a box somewhere to change it Needs css/theme support --- .gitignore | 4 +++- client_backbone/css/style.css | 5 +++++ client_backbone/dev/app.js | 0 client_backbone/dev/applet_nickserv.js | 0 client_backbone/dev/applet_settings.js | 0 client_backbone/dev/build.js | 0 client_backbone/dev/model_applet.js | 0 client_backbone/dev/model_application.js | 2 +- client_backbone/dev/model_channel.js | 0 client_backbone/dev/model_member.js | 0 client_backbone/dev/model_memberlist.js | 0 client_backbone/dev/model_panel.js | 0 client_backbone/dev/model_panellist.js | 0 client_backbone/dev/model_server.js | 0 client_backbone/dev/utils.js | 0 client_backbone/dev/view.js | 25 ++++++++++++++++++++++-- client_backbone/index.html | 6 ++++++ 17 files changed, 38 insertions(+), 4 deletions(-) mode change 100644 => 100755 client_backbone/dev/app.js mode change 100644 => 100755 client_backbone/dev/applet_nickserv.js mode change 100644 => 100755 client_backbone/dev/applet_settings.js mode change 100644 => 100755 client_backbone/dev/build.js mode change 100644 => 100755 client_backbone/dev/model_applet.js mode change 100644 => 100755 client_backbone/dev/model_application.js mode change 100644 => 100755 client_backbone/dev/model_channel.js mode change 100644 => 100755 client_backbone/dev/model_member.js mode change 100644 => 100755 client_backbone/dev/model_memberlist.js mode change 100644 => 100755 client_backbone/dev/model_panel.js mode change 100644 => 100755 client_backbone/dev/model_panellist.js mode change 100644 => 100755 client_backbone/dev/model_server.js mode change 100644 => 100755 client_backbone/dev/utils.js mode change 100644 => 100755 client_backbone/dev/view.js diff --git a/.gitignore b/.gitignore index 0880872..12c2df5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.DS_* node/node_modules/ node_modules/ -doc/ \ No newline at end of file +doc/ +client_backbone/kiwi.js +client_backbone/kiwi.min.js diff --git a/client_backbone/css/style.css b/client_backbone/css/style.css index 4274484..01525af 100644 --- a/client_backbone/css/style.css +++ b/client_backbone/css/style.css @@ -155,6 +155,11 @@ a { color:#36C; text-decoration:none; cursor:pointer; } height:100%; width:100%; } +#controlbox .nickchange { + position: absolute; + left: 0px; +} + #topic { background-color:#1B1B1B; height:2em; position:relative; } diff --git a/client_backbone/dev/app.js b/client_backbone/dev/app.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/applet_nickserv.js b/client_backbone/dev/applet_nickserv.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/applet_settings.js b/client_backbone/dev/applet_settings.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/build.js b/client_backbone/dev/build.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_applet.js b/client_backbone/dev/model_applet.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_application.js b/client_backbone/dev/model_application.js old mode 100644 new mode 100755 index f6e9c75..c9c5fd1 --- a/client_backbone/dev/model_application.js +++ b/client_backbone/dev/model_application.js @@ -496,7 +496,7 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { if (kiwi.app.panels.server !== kiwi.app.panels.active) { kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname'); } - // TODO: Show a nick change box or something + (new kiwi.view.NickChangeBox()).render(); break; default: // We don't know what data contains, so don't do anything with it. diff --git a/client_backbone/dev/model_channel.js b/client_backbone/dev/model_channel.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_member.js b/client_backbone/dev/model_member.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_memberlist.js b/client_backbone/dev/model_memberlist.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_panel.js b/client_backbone/dev/model_panel.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_panellist.js b/client_backbone/dev/model_panellist.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/model_server.js b/client_backbone/dev/model_server.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/utils.js b/client_backbone/dev/utils.js old mode 100644 new mode 100755 diff --git a/client_backbone/dev/view.js b/client_backbone/dev/view.js old mode 100644 new mode 100755 index 620149a..08a5bac --- a/client_backbone/dev/view.js +++ b/client_backbone/dev/view.js @@ -59,6 +59,27 @@ kiwi.view.UserBox = Backbone.View.extend({ } }); +kiwi.view.NickChangeBox = Backbone.View.extend({ + events: { + 'click .btn_nickchange': 'changeNick' + }, + + initialize: function () { + this.$el = $($('#tmpl_nickchange').html()); + }, + + render: function () { + $('#controlbox').prepend(this.$el); + this.$el.css('bottom', $('#controlbox').height()); + }, + + changeNick: function (event) {; + var el = this.$el; + kiwi.gateway.changeNick($('#nickchange', this.$el).val(), function (err, val) { + el.remove(); + }); + } +}); kiwi.view.ServerSelect = Backbone.View.extend({ events: { @@ -293,7 +314,7 @@ kiwi.view.Panel = Backbone.View.extend({ if (this.model == kiwi.app.panels.active) return; var types, type_idx; - var types = ['none', 'action', 'activity', 'highlight']; + types = ['none', 'action', 'activity', 'highlight']; // Default alert level level = level || 'none'; @@ -313,7 +334,7 @@ kiwi.view.Panel = Backbone.View.extend({ // Clear any existing levels this.model.tab.removeClass(function (i, css) { - return (css.match (/\balert_\S+/g) || []).join(' '); + return (css.match(/\balert_\S+/g) || []).join(' '); }); // Add the new level if there is one diff --git a/client_backbone/index.html b/client_backbone/index.html index 0e915ad..07f01bd 100755 --- a/client_backbone/index.html +++ b/client_backbone/index.html @@ -43,6 +43,12 @@ Info + +