mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-07 14:33:16 +02:00
improve hg config
This commit is contained in:
@@ -20,5 +20,39 @@ registerConfigPanel({
|
||||
name: 'baseUrl',
|
||||
fieldLabel: 'Base URL',
|
||||
allowBlank : false
|
||||
}]
|
||||
}],
|
||||
|
||||
onSubmit: function(values){
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'config/repositories/hg.json',
|
||||
method: 'POST',
|
||||
jsonData: values,
|
||||
scope: this,
|
||||
success: function(response){
|
||||
alert( 'success' );
|
||||
},
|
||||
failure: function(){
|
||||
alert( 'failure' );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onLoad: function(){
|
||||
//this.getEl().mask();
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'config/repositories/hg.json',
|
||||
method: 'GET',
|
||||
scope: this,
|
||||
success: function(response){
|
||||
var obj = Ext.decode(response.responseText);
|
||||
this.load(obj);
|
||||
//this.getEl().unmask();
|
||||
},
|
||||
failure: function(){
|
||||
alert( 'failure' );
|
||||
//this.getEl().unmask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -33,6 +33,9 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
|
||||
|
||||
title: 'Config Form',
|
||||
items: null,
|
||||
onSubmit: null,
|
||||
getValues: null,
|
||||
onCancel: null,
|
||||
|
||||
initComponent: function(){
|
||||
|
||||
@@ -61,15 +64,41 @@ Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
|
||||
},
|
||||
items: this.items,
|
||||
buttons: [{
|
||||
text: 'Save'
|
||||
text: 'Save',
|
||||
scope: this,
|
||||
handler: this.submitForm
|
||||
},{
|
||||
text: 'Cancel'
|
||||
text: 'Cancel',
|
||||
scope: this,
|
||||
handler: this.cancel
|
||||
}]
|
||||
}]
|
||||
};
|
||||
|
||||
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});
|
||||
},
|
||||
|
||||
submitForm: function(){
|
||||
var form = this.getForm();
|
||||
if ( this.onSubmit != null && Ext.isFunction( this.onSubmit ) ){
|
||||
this.onSubmit( form.getValues() );
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function(){
|
||||
var form = this.getForm();
|
||||
if ( this.onCancel != null && Ext.isFunction( this.onCancel ) ){
|
||||
this.onCancel(form);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user