From 5326622e75e5cc41fb243441d1e889d71709cb7a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 19 Sep 2010 18:43:16 +0200 Subject: [PATCH] mask form on load --- .../src/main/resources/sonia/scm/hg.config.js | 19 ++++++++++++------- .../main/webapp/resources/js/sonia.config.js | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js index c6f85324b4..44861ab69e 100644 --- a/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js +++ b/plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js @@ -23,34 +23,39 @@ registerConfigPanel({ }], onSubmit: function(values){ + this.el.mask('Submit ...'); Ext.Ajax.request({ url: restUrl + 'config/repositories/hg.json', method: 'POST', jsonData: values, scope: this, + disableCaching: true, success: function(response){ - alert( 'success' ); + this.el.unmask(); }, failure: function(){ - alert( 'failure' ); + this.el.unmask(); } }); }, - onLoad: function(){ - //this.getEl().mask(); + onLoad: function(el){ + var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); Ext.Ajax.request({ url: restUrl + 'config/repositories/hg.json', method: 'GET', scope: this, + disableCaching: true, success: function(response){ var obj = Ext.decode(response.responseText); this.load(obj); - //this.getEl().unmask(); + clearTimeout(tid); + el.unmask(); }, failure: function(){ - alert( 'failure' ); - //this.getEl().unmask(); + el.unmask(); + clearTimeout(tid); + alert('failure'); } }); } diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.config.js b/scm-webapp/src/main/webapp/resources/js/sonia.config.js index 7c7c62f143..9a04702ccd 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.config.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.config.js @@ -61,6 +61,14 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, { layoutConfig : { labelSeparator : '' }, + listeners: { + render: function(){ + if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){ + this.onLoad(this.el); + } + }, + scope: this + }, items: this.items, buttons: [{ text: 'Save', @@ -78,14 +86,13 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, { Ext.apply(this, Ext.apply(this.initialConfig, config)); Sonia.config.ConfigForm.superclass.initComponent.apply(this, arguments); - - if ( this.onLoad != null && Ext.isFunction( this.onLoad ) ){ - this.onLoad(); - } }, load: function(values){ - this.getForm().loadRecord({success: true, data: values}); + this.getForm().loadRecord({ + success: true, + data: values + }); }, submitForm: function(){