[Lada-commits] [PATCH 2 of 4] Show warnings in proben edit form
Wald Commits
scm-commit at wald.intevation.org
Thu Sep 12 12:30:16 CEST 2013
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1378981917 -7200
# Node ID de73dc41f1d301e8fd7277428725d3e236dadec2
# Parent 85238577adc969078c752bfff6f9a90cd5546945
Show warnings in proben edit form.
diff -r 85238577adc9 -r de73dc41f1d3 app/view/widgets/LadaForm.js
--- a/app/view/widgets/LadaForm.js Thu Sep 12 12:31:27 2013 +0200
+++ b/app/view/widgets/LadaForm.js Thu Sep 12 12:31:57 2013 +0200
@@ -119,12 +119,12 @@
onModelLoadSuccess: function(record, operation) {
this.bindModel(record);
- this.parseResponse(operation);
+ this.parseResponse(operation.response);
this.fireEvent('loadsuccess', this, record, operation);
},
onModelLoadFailure: function(record, operation) {
- this.parseResponse(operation);
+ this.parseResponse(operation.response);
this.fireEvent('loadfailure', this, record, operation);
},
@@ -188,8 +188,53 @@
this.errors = this.translateReturnCodes(json.errors);
this.warnings = this.translateReturnCodes(json.warnings);
this.message = Lada.getApplication().bundle.getMsg(json.message);
+ var e = Ext.Object.isEmpty(this.warnings);
+ if (!Ext.Object.isEmpty(this.warnings) ||
+ !Ext.Object.isEmpty(this.errors)) {
+ this.createMessages();
+ }
} else {
this.setReadOnly(this.model.get('readonly'));
}
+ },
+ createMessages: function() {
+ var messages = Ext.create('Ext.form.Panel', {
+ bodyPadding: '5 5 5 5'
+ });
+ for (var key in this.warnings) {
+ var 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);
+ }
+ for (var key in this.errors) {
+ var 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);
+ }
+ this.insert(0, messages);
}
});
More information about the Lada-commits
mailing list