changeset 296:529da633b8e3

Inherit from Base controller
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 09 Aug 2013 15:00:07 +0200
parents 841dc60824b5
children 1e1ee8abf91b
files app/controller/Zusatzwerte.js
diffstat 1 files changed, 4 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Zusatzwerte.js	Fri Aug 09 15:00:07 2013 +0200
+++ b/app/controller/Zusatzwerte.js	Fri Aug 09 15:00:07 2013 +0200
@@ -1,5 +1,5 @@
 Ext.define('Lada.controller.Zusatzwerte', {
-    extend: 'Ext.app.Controller',
+    extend: 'Lada.controller.Base',
     views: [
         'zusatzwerte.Create'
     ],
@@ -10,9 +10,10 @@
     ],
     init: function() {
         console.log('Initialising the Zusatzwerte controller');
+        this.callParent();
+    },
+    addListeners: function() {
         this.control({
-            // CSS like selector to select element in the viewpzusatzwert. See
-            // ComponentQuery documentation for more details.
             'zusatzwertelist': {
                 itemdblclick: this.editZusatzwert
             },
@@ -35,11 +36,6 @@
             }
         });
     },
-    saveZusatzwert: function(button) {
-        console.log('Saving Zusatzwert');
-        var form = button.up('window').down('form');
-        form.commit();
-    },
     addZusatzwert: function(button) {
         console.log('Adding new Zusatzwert for Probe' + button.probeId);
         var zusatzwert = Ext.create('Lada.model.Zusatzwert');
@@ -53,27 +49,6 @@
         view.down('probenzusatzwert').disabled = true;
         console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID
     },
-    deleteZusatzwert: function(button) {
-        // Get selected item in grid
-        var grid = button.up('grid');
-        var selection = grid.getView().getSelectionModel().getSelection()[0];
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
-            if(btn === 'yes'){
-                var store = grid.getStore();
-                var deleteUrl = selection.getProxy().url + selection.getEidi();
-                Ext.Ajax.request({
-                    url: deleteUrl,
-                    method: 'DELETE',
-                    success: function(response, opts) {
-                        store.reload();
-                    }
-                });
-                console.log('Deleting Kommentar');
-            } else {
-                console.log('Cancel Deleting Kommentar');
-            }
-        });
-    },
     createSuccess: function(form, record, operation) {
         // Reload store
         var store = this.getZusatzwerteStore();
@@ -81,27 +56,11 @@
         var win = form.up('window');
         win.close();
     },
-    createFailure: function(form, record, operation) {
-        Ext.MessageBox.show({
-            title: 'Fehler beim Speichern',
-            msg: form.message,
-            icon: Ext.MessageBox.ERROR,
-            buttons: Ext.Msg.OK
-        });
-    },
     editSuccess: function(form, record, operation) {
         // Reload store
         var store = this.getZusatzwerteStore();
         store.reload();
         var win = form.up('window');
         win.close();
-    },
-    editFailure: function(form, record, operation) {
-        Ext.MessageBox.show({
-            title: 'Fehler beim Speichern',
-            msg: form.message,
-            icon: Ext.MessageBox.ERROR,
-            buttons: Ext.Msg.OK
-        });
     }
 });

http://lada.wald.intevation.org