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

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


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

diff -r 1bda6420c87c -r fe51239321d9 app/controller/Messwert.js
--- a/app/controller/Messwert.js	Fri Aug 09 15:00:06 2013 +0200
+++ b/app/controller/Messwert.js	Fri Aug 09 15:00:06 2013 +0200
@@ -1,5 +1,8 @@
+/**
+ * Controller for Messwerte
+ */
 Ext.define('Lada.controller.Messwert', {
-    extend: 'Ext.app.Controller',
+    extend: 'Lada.controller.Base',
     views: [
         'messwerte.Create'
     ],
@@ -11,21 +14,22 @@
         'Messgroessen'
     ],
     init: function() {
-        console.log('Initialising the Messungen controller');
+        console.log('Initialising the Messwert controller');
+        this.callParent();
+    },
+    addListeners: function() {
         this.control({
-            // CSS like selector to select element in the viewpzusatzwert. See
-            // ComponentQuery documentation for more details.
             'messwertelist': {
-                itemdblclick: this.editMesswert
+                itemdblclick: this.editItem
             },
             'messwertelist toolbar button[action=add]': {
-                click: this.addMesswert
+                click: this.addItem
             },
             'messwertelist toolbar button[action=delete]': {
-                click: this.deleteMesswert
+                click: this.deleteItem
             },
             'messwertecreate button[action=save]': {
-                click: this.saveMesswert
+                click: this.saveItem
             },
             'messwertecreate form': {
                 savesuccess: this.createSuccess,
@@ -33,19 +37,19 @@
             }
         });
     },
-    saveMesswert: function(button) {
+    saveItem: function(button) {
         console.log('Saving MesswerMesswert');
         var form = button.up('window').down('form');
         form.commit();
     },
-    addMesswert: function(button) {
+    addItem: function(button) {
         console.log('Adding new Messwert for Messung ' + button.parentId + ' for Probe ' + button.probeId);
         var messung = Ext.create('Lada.model.Messwert');
         messung.set('probeId', button.probeId);
         messung.set('messungsId', button.parentId);
         var view = Ext.widget('messwertecreate', {model: messung});
     },
-    editMesswert: function(grid, record) {
+    editItem: function(grid, record) {
         console.log('Editing Messwert');
         var probe = this.getProbenStore().getById(record.get('probeId'));
         var view = Ext.widget('messwertecreate', {model: record});
@@ -56,7 +60,7 @@
 
         console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
     },
-    deleteMesswert: function(button) {
+    deleteItem: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
         Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){


More information about the Lada-commits mailing list