[Lada-commits] [PATCH 09 of 56] Inherit from Base controller

Wald Commits scm-commit at wald.intevation.org
Tue Aug 13 09:53:35 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376053207 -7200
# Node ID bd77b605579169fc4c07d5a1313e064c28991976
# Parent  73a2c114db646dd9d0306bb5948cf05ebe2795d4
Inherit from Base controller

diff -r 73a2c114db64 -r bd77b6055791 app/controller/Proben.js
--- a/app/controller/Proben.js	Fri Aug 09 15:00:06 2013 +0200
+++ b/app/controller/Proben.js	Fri Aug 09 15:00:07 2013 +0200
@@ -1,5 +1,8 @@
+/**
+ * Controller for Proben
+ */
 Ext.define('Lada.controller.Proben', {
-    extend: 'Ext.app.Controller',
+    extend: 'Lada.controller.Base',
     views: [
         'proben.Edit',
         'proben.Create'
@@ -14,20 +17,21 @@
     ],
     init: function() {
         console.log('Initialising the Proben controller');
+        this.callParent();
+    },
+    addListeners: function() {
         this.control({
-            // CSS like selector to select element in the viewport. See
-            // ComponentQuery documentation for more details.
             'probenlist': {
-                itemdblclick: this.editProbe
+                itemdblclick: this.editItem
             },
             'probenlist toolbar button[action=add]': {
-                click: this.addProbe
+                click: this.addItem
             },
             'probencreate button[action=save]': {
-                click: this.saveProbe
+                click: this.saveItem
             },
             'probenedit button[action=save]': {
-                click: this.saveProbe
+                click: this.saveItem
             },
             'probencreate form': {
                 savesuccess: this.createSuccess,
@@ -39,16 +43,11 @@
             }
         });
     },
-    saveProbe: function(button) {
-        console.log('Saving Probe');
-        var form = button.up('window').down('form');
-        form.commit();
-    },
-    addProbe: function(button) {
+    addItem: function(button) {
         console.log('Adding new Probe');
         var view = Ext.widget('probencreate');
     },
-    editProbe: function(grid, record) {
+    editItem: function(grid, record) {
         console.log('Editing Probe');
         var id = record.get('probeId');
         var view = Ext.widget('probenedit', {modelId: id});
@@ -100,32 +99,16 @@
                 if (json) {
                     var probeId = json.data.probeId;
                     var probe = store.findRecord("probeId", probeId);
-                    this.editProbe(null, probe);
+                    this.editItem(null, probe);
                 }
             }
         });
     },
-    createFailure: function(form, record, response) {
-        Ext.MessageBox.show({
-            title: 'Fehler beim Speichern',
-            msg: form.message,
-            icon: Ext.MessageBox.ERROR,
-            buttons: Ext.Msg.OK
-        });
-    },
     editSuccess: function(form, record, response) {
         // Reload store
         var store = this.getProbenStore();
         store.reload();
         var win = form.up('window');
         win.close();
-    },
-    editFailure: function(form, record, response) {
-        Ext.MessageBox.show({
-            title: 'Fehler beim Speichern',
-            msg: form.message,
-            icon: Ext.MessageBox.ERROR,
-            buttons: Ext.Msg.OK
-        });
     }
 });


More information about the Lada-commits mailing list