Mercurial > lada > lada-client
diff app/view/widgets/LadaForm.js @ 406:de73dc41f1d3
Show warnings in proben edit form.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 12 Sep 2013 12:31:57 +0200 |
parents | 8a3991b5c200 |
children | debfcc7713e3 |
line wrap: on
line diff
--- 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); } });