[Lada-commits] [PATCH] Datensatzerzeuger now uses the server. Added i18n to confirmation messages

Wald Commits scm-commit at wald.intevation.org
Fri Jan 15 14:42:45 CET 2016


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1452865349 -3600
# Branch stammdatengrids
# Node ID 15d8c64049d1c064640260f4228f0f437ff8aceb
# Parent  f73ca04d73a7917cbed9c6fa12fbeb87d2cf6b34
Datensatzerzeuger now uses the server. Added i18n to confirmation messages

diff -r f73ca04d73a7 -r 15d8c64049d1 app/controller/grid/Datensatzerzeuger.js
--- a/app/controller/grid/Datensatzerzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/Datensatzerzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,7 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
-        context.record.set('datum', new Date());
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -49,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -91,8 +91,11 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
+        var i18n = Lada.getApplication().bundle;
         //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -102,16 +105,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.getMsg('err.msg.generic.body'));
                             }
                         } else {
-                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
diff -r f73ca04d73a7 -r 15d8c64049d1 app/controller/grid/MessprogrammKategorie.js
--- a/app/controller/grid/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,6 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -48,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -78,7 +79,7 @@
     add: function(button) {
         var record = Ext.create('Lada.model.MessprogrammKategorie');
         button.up('messprogrammkategoriegrid').store.insert(0, record);
-        button.up('probenehmergrid').rowEditing.startEdit(0, 1);
+        button.up('messprogrammkategoriegrid').rowEditing.startEdit(0, 1);
     },
 
     /**
@@ -90,8 +91,10 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
-        //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        var i18n = Lada.getApplication().bundle;
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -101,16 +104,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.getMsg('err.msg.generic.body'));
                             }
                         } else {
-                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
diff -r f73ca04d73a7 -r 15d8c64049d1 app/controller/grid/Probenehmer.js
--- a/app/controller/grid/Probenehmer.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/Probenehmer.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,6 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -48,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -90,8 +91,10 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
-        //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        var i18n = Lada.getApplication().bundle;
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -101,16 +104,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.getMsg('err.msg.generic.body'));
                             }
                         } else {
-                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
diff -r f73ca04d73a7 -r 15d8c64049d1 app/model/DatensatzErzeuger.js
--- a/app/model/DatensatzErzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/DatensatzErzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -31,6 +31,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -47,13 +48,14 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
 
     proxy: {
-        type: 'memory',
-        //url: 'lada-server/rest/datensatzerzeuger',
+        type: 'rest',
+        url: 'lada-server/rest/datensatzerzeuger',
         reader: {
             type: 'json',
             root: 'data'
diff -r f73ca04d73a7 -r 15d8c64049d1 app/model/MessprogrammKategorie.js
--- a/app/model/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -29,6 +29,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -45,6 +46,7 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
diff -r f73ca04d73a7 -r 15d8c64049d1 app/model/Probenehmer.js
--- a/app/model/Probenehmer.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/Probenehmer.js	Fri Jan 15 14:42:29 2016 +0100
@@ -47,6 +47,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -63,6 +64,7 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
diff -r f73ca04d73a7 -r 15d8c64049d1 app/store/DatensatzErzeuger.js
--- a/app/store/DatensatzErzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/store/DatensatzErzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -12,14 +12,4 @@
 Ext.define('Lada.store.DatensatzErzeuger', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.DatensatzErzeuger',
-    data: {
-        data: {
-            id: 1,
-            netzbetreiberId: 'F',
-            daErzeugerId: 5,
-            mstId: '12020',
-            bezeichnung: 'ABCDÄ',
-            letzteAenderung: new Date()
-        }
-    }
 });
diff -r f73ca04d73a7 -r 15d8c64049d1 app/view/grid/MessprogrammKategorie.js
--- a/app/view/grid/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/view/grid/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -46,6 +46,18 @@
                 xtype: 'tbtext',
                 id: 'tbtitle',
                 text: i18n.getMsg('mk.gridTitle')
+            },
+            '->',
+            {
+                text: i18n.getMsg('mk.button.add'),
+                icon: 'resources/img/list-add.png',
+                action: 'add',
+                disabled: true // disabled on startup, will be enabled by setStore
+            }, {
+                text: i18n.getMsg('mk.button.delete'),
+                icon: 'resources/img/list-remove.png',
+                action: 'delete',
+                disabled: true // disabled on startup, will be enabled by controller if necessary
             }]
         }];
 
diff -r f73ca04d73a7 -r 15d8c64049d1 resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties	Wed Jan 13 14:50:28 2016 +0100
+++ b/resources/i18n/Lada_de-DE.properties	Fri Jan 15 14:42:29 2016 +0100
@@ -149,6 +149,8 @@
 
 undefined:Nicht definiert
 
+confirmation.question: Sind Sie sich sicher?
+
 ##
 # Msg:
 ##


More information about the Lada-commits mailing list