partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

LoginDialog.js (1425B)


      1 /**
      2  * Defines the login dialog
      3  */
      4 Ext.define('PartKeepr.LoginDialog', {
      5     extend: 'Ext.form.Panel',
      6 
      7     title: i18n("PartKeepr: Login"),
      8 
      9     controller: 'LoginController',
     10 
     11     keyMap: {
     12         ESC: 'onEsc',
     13         ENTER: 'login'
     14     },
     15 
     16     floated: true,
     17     centered: true,
     18     shadow: true,
     19 
     20     showAnimation: {
     21         type: 'fadeIn',
     22         duration: 250
     23     },
     24 
     25     items: [{
     26         xtype: "fieldset",
     27         items: [{
     28             xtype: 'textfield',
     29             itemId: 'username',
     30             label: i18n("Username")
     31         }, {
     32             xtype: 'passwordfield',
     33             itemId: 'password',
     34             label: i18n("Password")
     35         }]
     36     }, {
     37         docked: 'bottom',
     38         xtype: 'toolbar',
     39         shadow: false,
     40         items: [{
     41             xtype: 'button',
     42             text: 'Login',
     43             handler: 'login'
     44         }]
     45     }],
     46     /**
     47      * Initializes the login dialog component
     48      *
     49      */
     50     initialize: function () {
     51         this.callParent(arguments);
     52 
     53         // Focus the login field on show
     54         // @workaround Set the focus 100ms after the dialog has been shown.
     55         this.on("show", function () {
     56             this.down("#username").focus();
     57         }, this, {delay: 100});
     58     },
     59     getUsername: function () {
     60         return this.down("#username").getValue();
     61     },
     62     getPassword: function () {
     63         return this.down("#password").getValue();
     64     }
     65 
     66 });