Merge branch 'winston' of https://github.com/M2Ys4U/KiwiIRC into winston
[KiwiIRC.git] / client / src / applets / startup.js
1 (function () {
2 var view = Backbone.View.extend({
3 events: {},
4
5
6 initialize: function (options) {
7 this.showConnectionDialog();
8 },
9
10
11 showConnectionDialog: function() {
12 var connection_dialog = this.connection_dialog = new _kiwi.model.NewConnection();
13 connection_dialog.populateDefaultServerSettings();
14
15 connection_dialog.view.$el.addClass('initial');
16 this.$el.append(connection_dialog.view.$el);
17
18 var $info = $($('#tmpl_new_connection_info').html().trim());
19
20 if ($info.html()) {
21 connection_dialog.view.infoBoxSet($info);
22 connection_dialog.view.infoBoxShow();
23 }
24
25 this.listenTo(connection_dialog, 'connected', this.newConnectionConnected);
26
27 _.defer(function(){
28 connection_dialog.view.$el.find('.nick').select();
29 });
30 },
31
32
33 newConnectionConnected: function(network) {
34 // Once connected, reset the connection form to be used again in future
35 this.connection_dialog.view.reset();
36 }
37 });
38
39
40
41 var applet = Backbone.Model.extend({
42 initialize: function () {
43 this.view = new view({model: this});
44 }
45 });
46
47
48 _kiwi.model.Applet.register('kiwi_startup', applet);
49 })();