[Lada-commits] [PATCH 3 of 3] As the model now should have a readonly flag, the check if the form must be

Wald Commits scm-commit at wald.intevation.org
Fri Jul 5 14:50:24 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1373028555 -7200
# Node ID 214d1b274a506d85fbc9d6c1996694a38c00c6a3
# Parent  0fcec0c8c0725aa78bbbdac5e8774489044ddeda
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.

diff -r 0fcec0c8c072 -r 214d1b274a50 app/view/widgets/LadaForm.js
--- a/app/view/widgets/LadaForm.js	Fri Jul 05 14:47:19 2013 +0200
+++ b/app/view/widgets/LadaForm.js	Fri Jul 05 14:49:15 2013 +0200
@@ -59,6 +59,11 @@
     bindModel: function(model) {
         this.model = model;
         this.loadRecord(model);
+        // Set the form to readonly if the models readonly attribute is
+        // anything dffernt from true
+        if (model.get('readonly') !== false) {
+            this.setReadOnly(true);
+        }
     },
 
     commit: function(callback, scope) {
@@ -125,7 +130,6 @@
             this.errors = this.translateReturnCodes(json.errors);
             this.warnings = this.translateReturnCodes(json.warnings);
             this.message = Lada.getApplication().bundle.getMsg(json.message);
-            this.setReadOnly(json.readonly);
         } else {
             this.setReadOnly(true);
         }


More information about the Lada-commits mailing list