partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 4a1c99c2a63487d02daf0bb4270b67989f941ca9
parent 59ae82b5cdef9c8516e4dba2777aa6a0010547a2
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu,  5 Nov 2015 17:26:35 +0100

Don't re-edit the saved record for parts, because this messes up the part duplication/blank item functionality. Relates to #472

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/Editor.js | 5++++-
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js | 23+++++++++++++++--------
2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/Editor.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/Editor.js @@ -16,6 +16,7 @@ Ext.define('PartKeepr.Editor', { }, enableButtons: true, titleProperty: 'name', + editAfterSave: true, // If false, determinates if we should sync via the store or the record itself. // If true, always syncs the record via it's own proxy. @@ -119,6 +120,8 @@ Ext.define('PartKeepr.Editor', { this.fireEvent("itemSaved", this.record); } - this.editItem(record); + if (this.editAfterSave) { + this.editItem(record); + } } }); diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/Editor/PartEditor.js @@ -12,6 +12,7 @@ Ext.define('PartKeepr.PartEditor', { // Layout stuff border: false, layout: 'fit', + editAfterSave: false, /** * Initializes the editor fields @@ -395,22 +396,28 @@ Ext.define('PartKeepr.PartEditor', { var newItem; if (this.partMode == "create") { if (this.copyPartDataCheckbox.getValue() === true) { - data = this.record.getData(true); - data.id = null; - newItem = Ext.create("PartKeepr.PartBundle.Entity.Part"); - newItem.setDataWithAssociations(data); + var data = this.record.getData(); + console.log(data); + var newItem = Ext.create("PartKeepr.PartBundle.Entity.Part"); + newItem.set(data); + newItem.setAssociationData(this.record.getAssociationData()); this.editItem(newItem); } else { newItem = Ext.create("PartKeepr.PartBundle.Entity.Part", this.partDefaults); this.editItem(newItem); } } else { - var data = this.record.getData(true); - data.id = null; - newItem = Ext.create("PartKeepr.PartBundle.Entity.Part"); - newItem.setDataWithAssociations(data); + var data = this.record.getData(); + delete data["@id"]; + console.log(data); + var newItem = Ext.create("PartKeepr.PartBundle.Entity.Part"); + newItem.set(data); + newItem.setAssociationData(this.record.getAssociationData()); + + console.log(newItem); + newItem.foobar = 123; this.editItem(newItem); }