changeset 55:4fa3fba50f79

Added dialog for editing kommentare. Open the dialog on double click on a kommentar in the kommentarlist.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 28 May 2013 11:39:14 +0200
parents 3c7bfff8bd64
children 133fa41d3fe8
files app/controller/Kommentare.js app/view/kommentare/Edit.js
diffstat 2 files changed, 69 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Kommentare.js	Tue May 28 11:20:24 2013 +0200
+++ b/app/controller/Kommentare.js	Tue May 28 11:39:14 2013 +0200
@@ -1,7 +1,8 @@
 Ext.define('Lada.controller.Kommentare', {
     extend: 'Ext.app.Controller',
     views: [
-        'kommentare.List'
+        'kommentare.List',
+        'kommentare.Edit'
     ],
     stores: [
         'Kommentare'
@@ -14,35 +15,21 @@
         this.control({
             // CSS like selector to select element in the viewport. See
             // ComponentQuery documentation for more details.
-            //'probenlist': {
-            //    // Map the "render" event to the given function.
-            //    render: this.onPanelRendered,
-            //    // Map Doubleclick on rows of the probenlist.
-            //    itemdblclick: this.editProbe
-            //},
+            'kommentarelist': {
+                // Map Doubleclick on rows of the probenlist.
+                itemdblclick: this.editKommentar
+            }
             //'probenedit button[action=save]': {
             //    click: this.updateProbe
             //}
         });
     },
     editKommentar: function(grid, record) {
-        //console.log('Double click on ' + record.get('probeId'));
-        //// Create new window to edit the seletced record.
-        //var view = Ext.widget('probenedit');
-        //var form = view.down('form');
-        //form.loadRecord(record);
-
-        //// Load kommentare
-        //var kommentare = form.down('kommentarelist'); //form.down('kommentare');
-        //var kstore = kommentare.getStore();
-        //kstore.load({
-        //    params: {
-        //        probe: record.data['probeId']
-        //    }
-        //});
-
-        //// Set form data
-        //console.log("Loaded probe with ID " + record.getId()); //outputs ID
+        console.log('Double click on ' + record.get('id'));
+        // Create new window to edit the seletced record.
+        var view = Ext.widget('kommentaredit');
+        var form = view.down('form');
+        form.loadRecord(record);
     },
     updateKommentar: function(button) {
         //console.log('Click save');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/kommentare/Edit.js	Tue May 28 11:39:14 2013 +0200
@@ -0,0 +1,58 @@
+Ext.define('Lada.view.kommentare.Edit', {
+    extend: 'Ext.window.Window',
+    alias: 'widget.kommentaredit',
+
+    title: 'Maske für Kommentare',
+    // Make size of the dialog dependend of the available space.
+    // TODO: Handle resizing the browser window.
+    width: Ext.getBody().getViewSize().width - 30,
+    maxHeight: Ext.getBody().getViewSize().height - 30,
+    autoShow: true,
+    autoScroll: true,
+    modal: true,
+
+    requires: [
+    ],
+
+    initComponent: function() {
+        this.items = [
+            {
+                //Define the form
+                xtype: 'form',
+                bodyPadding: '10 10',
+                border: 0,
+                layout: 'fit',
+                items: [
+                    {
+                        xtype: 'textfield',
+                        name: 'erzeuger',
+                        fieldLabel: 'Erzeuger'
+                    },
+                    {
+                        xtype: 'textfield',
+                        name: 'kdatum',
+                        fieldLabel: 'Datum'
+                    },
+                    {
+                        xtype: 'textareafield',
+                        name: 'ktext',
+                        fieldLabel: 'Text'
+                    }
+                ]
+            }
+        ];
+        this.buttons = [
+            {
+                text: 'Speichern',
+                action: 'save'
+            },
+            {
+                text: 'Verwerfen',
+                scope: this,
+                handler: this.close
+            }
+        ];
+        this.callParent(arguments);
+    }
+});
+

http://lada.wald.intevation.org