Place to store the code and config used for the next-Iterations live event. https://iterations.space/live/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
1.2 KiB

_kiwi.view.NickChangeBox = Backbone.View.extend({
events: {
'submit': 'changeNick',
'click .cancel': 'close'
},
initialize: function () {
var text = {
new_nick: _kiwi.global.i18n.translate('client_views_nickchangebox_new').fetch(),
change: _kiwi.global.i18n.translate('client_views_nickchangebox_change').fetch(),
cancel: _kiwi.global.i18n.translate('client_views_nickchangebox_cancel').fetch()
};
this.$el = $(_.template($('#tmpl_nickchange').html().trim())(text));
},
render: function () {
// Add the UI component and give it focus
_kiwi.app.controlbox.$el.prepend(this.$el);
this.$el.find('input').focus();
this.$el.css('bottom', _kiwi.app.controlbox.$el.outerHeight(true));
},
close: function () {
this.$el.remove();
this.trigger('close');
},
changeNick: function (event) {
event.preventDefault();
var connection = _kiwi.app.connections.active_connection;
this.listenTo(connection, 'change:nick', function() {
this.close();
});
connection.gateway.changeNick(this.$('input').val());
}
});