Mercurial > lada > lada-client
changeset 628:e3cdc36cbcae
merged
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 16 Mar 2015 12:40:06 +0100 |
parents | 6742ae5f35dc (current diff) ee92e352be20 (diff) |
children | c58663165090 |
files | |
diffstat | 6 files changed, 138 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/FilterResult.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/FilterResult.js Mon Mar 16 12:40:06 2015 +0100 @@ -42,6 +42,9 @@ }, addItem: function(button) { + var win = Ext.create('Lada.view.window.ProbeCreate'); + win.show(); + win.initData(); },
--- a/app/controller/form/Messung.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/form/Messung.js Mon Mar 16 12:40:06 2015 +0100 @@ -32,9 +32,7 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true);
--- a/app/controller/form/Probe.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/form/Probe.js Mon Mar 16 12:40:06 2015 +0100 @@ -32,9 +32,7 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true);
--- a/app/controller/grid/Messung.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/grid/Messung.js Mon Mar 16 12:40:06 2015 +0100 @@ -38,9 +38,13 @@ win.initData(); }, - add: function() { - // TODO - console.log('add'); + add: function(button) { + var probe = button.up('window').record; + var win = Ext.create('Lada.view.window.MessungCreate', { + record: probe + }); + win.show(); + win.initData(); }, remove: function(button) { @@ -59,6 +63,7 @@ } }); } - }); + } + ); } });
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/MessungCreate.js Mon Mar 16 12:40:06 2015 +0100 @@ -0,0 +1,62 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/* + * Window to edit a Messung + */ +Ext.define('Lada.view.window.MessungCreate', { + extend: 'Ext.window.Window', + alias: 'widget.messungcreate', + + requires: [ + 'Lada.view.form.Messung' + ], + + collapsible: true, + maximizable: true, + autoshow: true, + autoscroll: true, + layout: 'fit', + + record: null, + + initComponent: function() { + this.title = 'Messung'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'messungform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + this.clearMessages(); + var messung = Ext.create('Lada.model.Messung', { + probeId: this.record.get('id') + }); + this.down('messungform').setRecord(messung); + }, + + setMessages: function(errors, warnings) { + //todo this is a stub + }, + clearMessages: function() { + //todo this is a stub + } + +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/ProbeCreate.js Mon Mar 16 12:40:06 2015 +0100 @@ -0,0 +1,62 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/* + * Window to edit a Probe + */ +Ext.define('Lada.view.window.ProbeCreate', { + extend: 'Ext.window.Window', + alias: 'widget.probecreate', + + requires: [ + 'Lada.view.form.Probe' + ], + + collapsible: true, + maximizable: true, + autoShow: true, + autoScroll: true, + layout: 'fit', + + record: null, + + initComponent: function() { + this.title = '§3-Probe'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + // InitialConfig is the config object passed to the constructor on + // creation of this window. We need to pass it throuh to the form as + // we need the "modelId" param to load the correct item. + + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'probeform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + var record = Ext.create('Lada.model.Probe'); + this.down('probeform').setRecord(record); + }, + + setMessages: function(errors, warnings) { + this.down('probeform').setMessages(errors, warnings); + }, + + clearMessages: function() { + this.down('probeform').clearMessages(); + } +});