added isUpdate method to rest form panel

This commit is contained in:
Sebastian Sdorra
2013-05-17 14:28:02 +02:00
parent 16848dbe69
commit 024fb17ea1
2 changed files with 7 additions and 3 deletions

View File

@@ -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,

View File

@@ -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);