Commit | Line | Data |
---|---|---|
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 | }, | |
23 | ||
24 | close: function () { | |
25 | this.$el.remove(); | |
26 | ||
27 | }, | |
28 | ||
29 | changeNick: function (event) { | |
30 | var that = this; | |
31 | ||
32 | event.preventDefault(); | |
33 | ||
34 | _kiwi.app.connections.active_connection.gateway.changeNick(this.$el.find('input').val(), function (err, val) { | |
35 | that.close(); | |
36 | }); | |
37 | return false; | |
38 | } | |
39 | }); |