[Lada-commits] [PATCH 3 of 4] Only hide save buttons if there are no fields which should be ignore while

Wald Commits scm-commit at wald.intevation.org
Thu Aug 15 14:09:09 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376568308 -7200
# Node ID 8a3991b5c200015ad296cc5bf2bbd395c0e89d9f
# Parent  302db31ac50acade84b7bf3f3005c18b10559a1f
Only hide save buttons if there are no fields which should be ignore while
setting the field to readonly.

diff -r 302db31ac50a -r 8a3991b5c200 app/view/widgets/LadaForm.js
--- a/app/view/widgets/LadaForm.js	Thu Aug 15 14:04:25 2013 +0200
+++ b/app/view/widgets/LadaForm.js	Thu Aug 15 14:05:08 2013 +0200
@@ -142,7 +142,6 @@
      * @param {Array} [ignoreFields="[]"] A list of fieldnames to ignore.
      */
     setReadOnly: function (bReadOnly, ignoreFields) {
-        console.log(ignoreFields);
         if(typeof(ignoreFields)==='undefined') {
             ignoreFields = Array();
         }
@@ -167,14 +166,19 @@
             for (var i = childs.length - 1; i >= 0; i--){
                 childs[i].setVisible(false);
             }
-            /* Find Save-Button and hide it */
-            var win = this.up('window');
-            var buttons = win.query('.button');
-            for (var j = buttons.length - 1; j >= 0; j--){
-                if (buttons[j].text === 'Speichern') {
-                    buttons[j].setVisible(false);
+            /*
+             * Find Save-Button and hide it. Only hide it if there are not
+             * fields left in the form which are editable
+             * */
+            if (ignoreFields.length == 0) {
+                var win = this.up('window');
+                var buttons = win.query('.button');
+                for (var j = buttons.length - 1; j >= 0; j--){
+                    if (buttons[j].text === 'Speichern') {
+                        buttons[j].setVisible(false);
+                    };
                 };
-            };
+            }
         }
     },
     parseResponse: function(response) {


More information about the Lada-commits mailing list