[Lada-commits] [PATCH] Statusworkflow: More work on the reset Button

Wald Commits scm-commit at wald.intevation.org
Fri Jan 8 14:34:43 CET 2016


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1452260067 -3600
# Node ID bf7bb9583a4036684ec915694a4ae4f6782f9550
# Parent  fb424948de023ea286273fdeac48e79626ab54ab
Statusworkflow: More work on the reset Button

diff -r fb424948de02 -r bf7bb9583a40 app/controller/grid/Status.js
--- a/app/controller/grid/Status.js	Thu Jan 07 16:20:48 2016 +0100
+++ b/app/controller/grid/Status.js	Fri Jan 08 14:34:27 2016 +0100
@@ -132,11 +132,13 @@
         var recentStatus = button.up('statusgrid').store.getById(s);
 
         //Set Status to 'Resetted' (8)
-        var record = recentStatus.copy();
-        record.set('datum', new Date());
-        record.set('statusWert', 8);
-        record.set('id', null);
-        record.set('text', null);
+        if (recentStatus) {
+            var record = recentStatus.copy();
+            record.set('datum', new Date());
+            record.set('statusWert', 8);
+            record.set('id', null);
+            record.set('text', null);
+        }
 
         Ext.Ajax.request({
             url: 'lada-server/status',
@@ -144,6 +146,7 @@
             method: 'POST',
             success: function(response) {
                 button.up('window').initData();
+                button.up('grid').initData();
             },
             failure: function(response) {
                 // TODO sophisticated error handling, with understandable Texts
diff -r fb424948de02 -r bf7bb9583a40 app/view/grid/Status.js
--- a/app/view/grid/Status.js	Thu Jan 07 16:20:48 2016 +0100
+++ b/app/view/grid/Status.js	Fri Jan 08 14:34:27 2016 +0100
@@ -185,11 +185,17 @@
         if (b == true){
             //Readonly
             this.down('button[action=add]').disable();
-            this.down('button[action=reset]').disable();
         }else{
             //Writable
             this.down('button[action=add]').enable();
+        }
+    },
+
+    setResetable: function(b) {
+        if (b == true){
             this.down('button[action=reset]').enable();
+        }else{
+            this.down('button[action=reset]').disable();
         }
     }
 });
diff -r fb424948de02 -r bf7bb9583a40 app/view/window/MessungEdit.js
--- a/app/view/window/MessungEdit.js	Thu Jan 07 16:20:48 2016 +0100
+++ b/app/view/window/MessungEdit.js	Fri Jan 08 14:34:27 2016 +0100
@@ -178,6 +178,14 @@
                 else {
                     this.disableStatusEdit();
                 }
+                //Check if it is allowed to reset Status
+                // TODO additional requirements?
+                if (this.record.get('statusEdit') === true) {
+                    this.enableStatusReset();
+                }
+                else {
+                    this.disableStatusReset();
+                }
             },
             scope: this
         });
@@ -210,6 +218,7 @@
             this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
             this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true;
             this.disableStatusEdit();
+            this.disableStatusReset();
     },
 
     /**
@@ -221,12 +230,26 @@
             this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
             this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
             this.enableStatusEdit();
+            this.enableStatusReset();
     },
 
     /**
+     * Enable to reset the statusgrid
+     */
+     enableStatusReset: function() {
+            this.down('fset[name=messungstatus]').down('statusgrid').setResetable(true);
+     },
+
+    /**
+     * Disable to reset the statusgrid
+     */
+     disableStatusReset: function() {
+            this.down('fset[name=messungstatus]').down('statusgrid').setResetable(false);
+     },
+    /**
      * Enable to edit the statusgrid
      */
-     enableStatusEdit: function () {
+     enableStatusEdit: function() {
             this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
             this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false;
      },
@@ -234,7 +257,7 @@
     /**
      * Disable to edit the statusgrid
      */
-     disableStatusEdit: function () {
+     disableStatusEdit: function() {
             this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
             this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
      },


More information about the Lada-commits mailing list