if (kiwi.app.panels.server !== kiwi.app.panels.active) {\r
kiwi.app.message.text('The nickname "' + data.nick + '" is already in use. Please select a new nickname');\r
}\r
- // TODO: Show a nick change box or something\r
+ (new kiwi.view.NickChangeBox()).render();\r
break;\r
default:\r
// We don't know what data contains, so don't do anything with it.\r
}\r
});\r
\r
+kiwi.view.NickChangeBox = Backbone.View.extend({\r
+ events: {\r
+ 'click .btn_nickchange': 'changeNick'\r
+ },\r
+ \r
+ initialize: function () {\r
+ this.$el = $($('#tmpl_nickchange').html());\r
+ },\r
+ \r
+ render: function () {\r
+ $('#controlbox').prepend(this.$el);\r
+ this.$el.css('bottom', $('#controlbox').height());\r
+ },\r
+ \r
+ changeNick: function (event) {;\r
+ var el = this.$el;\r
+ kiwi.gateway.changeNick($('#nickchange', this.$el).val(), function (err, val) {\r
+ el.remove();\r
+ });\r
+ }\r
+});\r
\r
kiwi.view.ServerSelect = Backbone.View.extend({\r
events: {\r
if (this.model == kiwi.app.panels.active) return;\r
\r
var types, type_idx;\r
- var types = ['none', 'action', 'activity', 'highlight'];\r
+ types = ['none', 'action', 'activity', 'highlight'];\r
\r
// Default alert level\r
level = level || 'none';\r
\r
// Clear any existing levels\r
this.model.tab.removeClass(function (i, css) {\r
- return (css.match (/\balert_\S+/g) || []).join(' ');\r
+ return (css.match(/\balert_\S+/g) || []).join(' ');\r
});\r
\r
// Add the new level if there is one\r
<a class="info">Info</a>
</div>
</script>
+
+ <script type="text/x-jquery-tmpl" id="tmpl_nickchange">
+ <div class="nickchange">
+ <label for="nickchange">New nick:</label> <input id="nickchange" type="text" mozactionhint="done" autocomplete="off" spellcheck="false"/> <input type="button" class="btn_nickchange" value="Change Nick" />
+ </div>
+ </script>
<script type="text/x-jquery-tmpl" id="tmpl_server_select">
<div class="server_select">