Dialog.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Ext.define('saas.view.auth.Dialog', {
  2. extend: 'Ext.form.Panel',
  3. xtype: 'authdialog',
  4. requires: [
  5. 'saas.view.auth.LoginController',
  6. 'Ext.form.Panel'
  7. ],
  8. /*
  9. * Seek out the first enabled, focusable, empty textfield when the form is focused
  10. */
  11. defaultFocus: 'textfield:focusable:not([hidden]):not([disabled]):not([value])',
  12. /**
  13. * @cfg {Boolean} [autoComplete=false]
  14. * Enables browser (or Password Managers) support for autoCompletion of User Id and
  15. * password.
  16. */
  17. autoComplete : false,
  18. initComponent: function () {
  19. var me = this, listen;
  20. if (me.autoComplete) {
  21. // Use standard FORM tag for detection by browser or password tools
  22. me.autoEl = Ext.applyIf(
  23. me.autoEl || {},
  24. {
  25. tag: 'form',
  26. name: 'authdialog',
  27. method: 'post'
  28. });
  29. }
  30. me.addCls('auth-dialog');
  31. me.callParent();
  32. if (me.autoComplete) {
  33. listen = {
  34. afterrender : 'doAutoComplete',
  35. scope : me,
  36. single : true
  37. };
  38. Ext.each(me.query('textfield'), function (field) {
  39. field.on(listen);
  40. });
  41. }
  42. },
  43. doAutoComplete : function(target) {
  44. if (target.inputEl && target.autoComplete !== false) {
  45. target.inputEl.set({ autocomplete: 'on' });
  46. }
  47. }
  48. });