Text theme fixes
[KiwiIRC.git] / client / src / views / nickchangebox.js
CommitLineData
50ac472f
D
1_kiwi.view.NickChangeBox = Backbone.View.extend({
2 events: {
3 'submit': 'changeNick',
4 'click .cancel': 'close'
5 },
0d29c21f 6
50ac472f 7 initialize: function () {
0d29c21f 8 var text = {
247dd7ac
N
9 new_nick: _kiwi.global.i18n.translate('client_views_nickchangebox_new').fetch(),
10 change: _kiwi.global.i18n.translate('client_views_nickchangebox_change').fetch(),
11 cancel: _kiwi.global.i18n.translate('client_views_nickchangebox_cancel').fetch()
0d29c21f
JA
12 };
13 this.$el = $(_.template($('#tmpl_nickchange').html().trim(), text));
50ac472f 14 },
0d29c21f 15
50ac472f
D
16 render: function () {
17 // Add the UI component and give it focus
18 _kiwi.app.controlbox.$el.prepend(this.$el);
19 this.$el.find('input').focus();
20
21 this.$el.css('bottom', _kiwi.app.controlbox.$el.outerHeight(true));
22 },
4caae868 23
50ac472f
D
24 close: function () {
25 this.$el.remove();
4caae868 26 this.trigger('close');
50ac472f
D
27 },
28
29 changeNick: function (event) {
50ac472f
D
30 event.preventDefault();
31
4caae868
D
32 var connection = _kiwi.app.connections.active_connection;
33 this.listenTo(connection, 'change:nick', function() {
34 this.close();
50ac472f 35 });
4caae868
D
36
37 connection.gateway.changeNick(this.$('input').val());
50ac472f
D
38 }
39});