tweak the way the login is built up

This commit is contained in:
Damien Churchill 2010-01-23 15:31:17 +00:00
parent f14b3a8459
commit 1b2d5bc6ad
1 changed files with 125 additions and 136 deletions

View File

@ -1,5 +1,5 @@
/*
Script: deluge-login.js
Script: Deluge.Login.js
Contains all objects and functions related to the login system.
Copyright:
@ -32,28 +32,21 @@ Copyright:
*/
(function(){
Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
firstShow: true,
constructor: function(config) {
config = Ext.apply({
layout: 'fit',
width: 300,
height: 120,
bodyStyle: 'padding: 10px 5px;',
buttonAlign: 'center',
closeAction: 'hide',
closable: false,
closeAction: 'hide',
iconCls: 'x-deluge-login-window-icon',
layout: 'fit',
modal: true,
plain: true,
resizable: false,
title: _('Login'),
iconCls: 'x-deluge-login-window-icon'
}, config);
Ext.deluge.LoginWindow.superclass.constructor.call(this, config);
},
width: 300,
height: 120,
initComponent: function() {
Ext.deluge.LoginWindow.superclass.initComponent.call(this);
@ -65,26 +58,23 @@ Copyright:
scope: this
});
this.loginForm = this.add({
this.form = this.add({
xtype: 'form',
defaultType: 'textfield',
id: 'loginForm',
baseCls: 'x-plain',
labelWidth: 55,
items: [{
width: 300,
defaults: {width: 200},
defaultType: 'textfield',
});
this.passwordField = this.form.add({
xtype: 'textfield',
fieldLabel: _('Password'),
id: 'password',
id: '_password',
name: 'password',
inputType: 'password',
anchor: '100%',
listeners: {
'specialkey': {
fn: this.onKey,
scope: this
}
}
}]
})
inputType: 'password'
});
this.passwordField.on('specialkey', this.onSpecialKey, this);
},
logout: function() {
@ -122,7 +112,7 @@ Copyright:
});
},
onKey: function(field, e) {
onSpecialKey: function(field, e) {
if (e.getKey() == 13) this.onLogin();
},
@ -164,7 +154,6 @@ Copyright:
passwordField.focus(false, 150);
passwordField.setRawValue('');
}
});
});
Deluge.Login = new Ext.deluge.LoginWindow();
})();
Deluge.Login = new Ext.deluge.LoginWindow();