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

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


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376053206 -7200
# Node ID 1bda6420c87c0a786220be1f9fb188bb02772ef5
# Parent  ea60be45fd4dbcab33aa02d66013fa5705717e5f
Inherit from Base controller

diff -r ea60be45fd4d -r 1bda6420c87c app/controller/Messungen.js
--- a/app/controller/Messungen.js	Fri Aug 09 14:58:58 2013 +0200
+++ b/app/controller/Messungen.js	Fri Aug 09 15:00:06 2013 +0200
@@ -1,5 +1,8 @@
+/**
+ * Controller for Messungen
+ */
 Ext.define('Lada.controller.Messungen', {
-    extend: 'Ext.app.Controller',
+    extend: 'Lada.controller.Base',
     views: [
         'messungen.Create',
         'messungen.Edit'
@@ -14,23 +17,23 @@
     ],
     init: function() {
         console.log('Initialising the Messungen controller');
+    },
+    addListeners: function() {
         this.control({
-            // CSS like selector to select element in the viewpzusatzwert. See
-            // ComponentQuery documentation for more details.
             'messungenlist': {
-                itemdblclick: this.editMessung
+                itemdblclick: this.editItem
             },
             'messungenlist toolbar button[action=add]': {
-                click: this.addMessung
+                click: this.addItem
             },
             'messungenlist toolbar button[action=delete]': {
-                click: this.deleteMessung
+                click: this.deleteItem
             },
             'messungencreate button[action=save]': {
-                click: this.saveMessung
+                click: this.saveItem
             },
             'messungenedit button[action=save]': {
-                click: this.saveMessung
+                click: this.saveItem
             },
             'messungencreate form': {
                 savesuccess: this.createSuccess,
@@ -42,18 +45,18 @@
             }
         });
     },
-    saveMessung: function(button) {
+    saveItem: function(button) {
         console.log('Saving new Messung for Probe ' + button.probeId);
         var form = button.up('window').down('form');
         form.commit();
     },
-    addMessung: function(button) {
+    addItem: function(button) {
         console.log('Adding new Messung for Probe ' + button.probeId);
         var messung = Ext.create('Lada.model.Messung');
         messung.set('probeId', button.probeId);
         var view = Ext.widget('messungencreate', {model: messung});
     },
-    editMessung: function(grid, record) {
+    editItem: function(grid, record) {
         console.log('Editing Messung');
         var kstore = this.getMKommentareStore();
         kstore.load({
@@ -89,7 +92,7 @@
         }
         console.log("Loaded Messung with ID " + record.getId()); //outputs ID
     },
-    deleteMessung: function(button) {
+    deleteItem: function(button) {
         // Get selected item in grid
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
@@ -111,7 +114,6 @@
         });
     },
     createSuccess: function(form, record, operation) {
-        // Reload store
         var store = this.getMessungenStore();
         store.reload();
         var win = form.up('window');
@@ -126,7 +128,6 @@
         });
     },
     editSuccess: function(form, record, operation) {
-        // Reload store
         var store = this.getMessungenStore();
         store.reload();
         var win = form.up('window');


More information about the Lada-commits mailing list