[Lada-commits] [PATCH 4 of 4] updated error and warning handling

Wald Commits scm-commit at wald.intevation.org
Thu Dec 18 15:03:40 CET 2014


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1418911461 -3600
# Node ID d2e90f117c2060b819b0843c98236e417f5db7d8
# Parent  ce188e2fab06b0c4d81be337507befb034592e05
updated error and warning handling.

diff -r ce188e2fab06 -r d2e90f117c20 app/view/widgets/LadaForm.js
--- a/app/view/widgets/LadaForm.js	Thu Dec 18 15:03:51 2014 +0100
+++ b/app/view/widgets/LadaForm.js	Thu Dec 18 15:04:21 2014 +0100
@@ -100,8 +100,8 @@
     },
 
     commit: function() {
-        if (this.form.isDirty() && this.form.isValid()) {
-
+        if (this.form.isDirty() &&
+            this.form.isValid()) {
             var data = this.model.getAllData();
             var baseUrl = this.model.getProxy().url;
             var url = baseUrl;
@@ -223,46 +223,15 @@
     },
 
     createMessages: function() {
-        var messages = Ext.create('Ext.form.Panel', {
-            bodyPadding: '5 5 5 5'
-        });
         var key;
-        var label;
         for (key in this.warnings) {
-            label = Ext.create('Ext.container.Container', {
-                layout: 'hbox',
-                bodyPadding: '5 5 5 5',
-                items: [{
-                    xtype: 'image',
-                    src: 'gfx/icon-warning.gif',
-                    width: 18,
-                    height: 18
-                }, {
-                    xtype: 'label',
-                    text: key + ': ' + this.warnings[key],
-                    margin: '4 0 0 5'
-                }]
-            });
-            messages.insert(0, label);
+            var element = this.down('component[name=' + key + ']');
+            element.showWarnings(this.warnings[key]);
         }
         for (key in this.errors) {
-            label = Ext.create('Ext.container.Container', {
-                layout: 'hbox',
-                bodyPadding: '5 5 5 5',
-                items: [{
-                    xtype: 'image',
-                    src: 'gfx/icon-error.gif',
-                    width: 18,
-                    height: 18
-                }, {
-                    xtype: 'label',
-                    text: key + ': ' + this.errors[key],
-                    margin: '4 0 0 5'
-                }]
-            });
-            messages.insert(0, label);
+            var element = this.down('component[name=' + key + ']');
+            element.showErrors(this.errors[key]);
         }
-        this.insert(0, messages);
     },
 
     updateOnChange: function() {


More information about the Lada-commits mailing list