mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-20 22:42:16 +01:00
added isUpdate method to rest form panel
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
Sonia.repository.SettingsFormPanel = Ext.extend(Sonia.repository.FormPanel, {
|
||||
|
||||
initComponent: function(){
|
||||
var update = this.item != null;
|
||||
var update = this.isUpdate();
|
||||
|
||||
var config = {
|
||||
title: this.formTitleText,
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
|
||||
Sonia.rest.FormPanel = Ext.extend(Ext.form.FormPanel,{
|
||||
|
||||
okText: 'Ok',
|
||||
cancelText: 'Cancel',
|
||||
@@ -66,6 +66,10 @@ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
|
||||
}
|
||||
},
|
||||
|
||||
isUpdate: function(){
|
||||
return this.item !== null;
|
||||
},
|
||||
|
||||
loadData: function(item){
|
||||
this.item = item;
|
||||
var data = {success: true, data: item};
|
||||
@@ -77,7 +81,7 @@ Sonia.rest.FormPanel = Ext.extend(Ext.FormPanel,{
|
||||
console.debug( 'form submitted' );
|
||||
}
|
||||
var item = this.getForm().getFieldValues();
|
||||
if ( this.item !== null ){
|
||||
if ( this.isUpdate() ){
|
||||
this.update(item);
|
||||
} else {
|
||||
this.create(item);
|
||||
|
||||
Reference in New Issue
Block a user