[Lada-commits] [PATCH 09 of 16] Add cancel Button to the editproben window and only show save button if the
Wald Commits
scm-commit at wald.intevation.org
Wed Aug 7 12:05:36 CEST 2013
# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1375792394 -7200
# Node ID 0d6552bb28ea602e14d4e1314b1ffa3c24ede85c
# Parent eda619ad45b0c011d4ba969dcb91acebff73d559
Add cancel Button to the editproben window and only show save button if the
form is actually writeable.
diff -r eda619ad45b0 -r 0d6552bb28ea app/controller/Proben.js
--- a/app/controller/Proben.js Mon Jul 29 15:53:24 2013 +0200
+++ b/app/controller/Proben.js Tue Aug 06 14:33:14 2013 +0200
@@ -23,6 +23,12 @@
'probenlist toolbar button[action=add]': {
click: this.addProbe
},
+ 'probencreate button[action=save]': {
+ click: this.saveProbe
+ },
+ 'probenedit button[action=save]': {
+ click: this.saveProbe
+ },
'probencreate form': {
savesuccess: this.createSuccess,
savefailure: this.createFailure
@@ -33,6 +39,11 @@
}
});
},
+ saveProbe: function(button) {
+ console.log('Saving Probe');
+ var form = button.up('window').down('form');
+ form.commit();
+ },
addProbe: function(button) {
console.log('Adding new Probe');
var view = Ext.widget('probencreate');
diff -r eda619ad45b0 -r 0d6552bb28ea app/view/messwerte/Create.js
--- a/app/view/messwerte/Create.js Mon Jul 29 15:53:24 2013 +0200
+++ b/app/view/messwerte/Create.js Tue Aug 06 14:33:14 2013 +0200
@@ -8,8 +8,6 @@
modal: true,
initComponent: function() {
- var form = Ext.create('Lada.view.messwerte.CreateForm', this.initialConfig);
- this.items = [form];
this.buttons = [
{
text: 'Speichern',
@@ -17,6 +15,8 @@
action: 'save'
}
];
+ var form = Ext.create('Lada.view.messwerte.CreateForm', this.initialConfig);
+ this.items = [form];
this.callParent();
}
});
diff -r eda619ad45b0 -r 0d6552bb28ea app/view/proben/Create.js
--- a/app/view/proben/Create.js Mon Jul 29 15:53:24 2013 +0200
+++ b/app/view/proben/Create.js Tue Aug 06 14:33:14 2013 +0200
@@ -16,8 +16,12 @@
this.buttons = [
{
text: 'Speichern',
- handler: form.commit,
- scope: form
+ action: 'save',
+ },
+ {
+ text: 'Abbrechen',
+ scope: this,
+ handler: this.close,
}
];
this.callParent();
diff -r eda619ad45b0 -r 0d6552bb28ea app/view/proben/Edit.js
--- a/app/view/proben/Edit.js Mon Jul 29 15:53:24 2013 +0200
+++ b/app/view/proben/Edit.js Tue Aug 06 14:33:14 2013 +0200
@@ -12,19 +12,23 @@
modal: true,
initComponent: function() {
+ this.buttons = [
+ {
+ text: 'Speichern',
+ action: 'save',
+ },
+ {
+ text: 'Abbrechen',
+ scope: this,
+ handler: this.close,
+ }
+ ];
// InitialConfig is the config object passed to the constructor on
// creation of this window. We need to pass it throuh to the form as
// we need the "modelId" param to load the correct item.
var form = Ext.create('Lada.view.proben.EditForm', this.initialConfig);
this.items = [form];
- this.buttons = [
- {
- text: 'Speichern',
- handler: form.commit,
- scope: form
- }
- ];
this.callParent();
- }
+ },
});
diff -r eda619ad45b0 -r 0d6552bb28ea app/view/widgets/LadaForm.js
--- a/app/view/widgets/LadaForm.js Mon Jul 29 15:53:24 2013 +0200
+++ b/app/view/widgets/LadaForm.js Tue Aug 06 14:33:14 2013 +0200
@@ -129,6 +129,14 @@
for (var i = childs.length - 1; i >= 0; i--){
childs[i].setVisible(false);
}
+ /* Find Save-Button and hide it */
+ var win = this.up('window');
+ var buttons = win.query('.button');
+ for (var j = buttons.length - 1; j >= 0; j--){
+ if (buttons[j].text === 'Speichern') {
+ buttons[j].setVisible(false);
+ };
+ };
}
},
parseResponse: function(response) {
More information about the Lada-commits
mailing list