comparison app/view/widgets/LadaForm.js @ 189:214d1b274a50

As the model now should have a readonly flag, the check if the form must be rendered as readonly was moved to the place where the model is actually bound to the form.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 05 Jul 2013 14:49:15 +0200
parents 0fcec0c8c072
children 401d559e0461
comparison
equal deleted inserted replaced
188:0fcec0c8c072 189:214d1b274a50
57 }, 57 },
58 58
59 bindModel: function(model) { 59 bindModel: function(model) {
60 this.model = model; 60 this.model = model;
61 this.loadRecord(model); 61 this.loadRecord(model);
62 // Set the form to readonly if the models readonly attribute is
63 // anything dffernt from true
64 if (model.get('readonly') !== false) {
65 this.setReadOnly(true);
66 }
62 }, 67 },
63 68
64 commit: function(callback, scope) { 69 commit: function(callback, scope) {
65 if (this.form.isDirty() && this.form.isValid()) { 70 if (this.form.isDirty() && this.form.isValid()) {
66 this.form.updateRecord(this.model); 71 this.form.updateRecord(this.model);
123 if (json) { 128 if (json) {
124 this.success = json.success; 129 this.success = json.success;
125 this.errors = this.translateReturnCodes(json.errors); 130 this.errors = this.translateReturnCodes(json.errors);
126 this.warnings = this.translateReturnCodes(json.warnings); 131 this.warnings = this.translateReturnCodes(json.warnings);
127 this.message = Lada.getApplication().bundle.getMsg(json.message); 132 this.message = Lada.getApplication().bundle.getMsg(json.message);
128 this.setReadOnly(json.readonly);
129 } else { 133 } else {
130 this.setReadOnly(true); 134 this.setReadOnly(true);
131 } 135 }
132 } 136 }
133 }); 137 });

http://lada.wald.intevation.org