From ac379dbb3f21c99482a1eeb488aae18f1677295d Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 10 Dec 2015 10:25:38 -0800 Subject: [PATCH] [New Edit Mode] Create menu still visible when edit mode initiated by pressing create #407 --- .../browse/src/creation/CreateAction.js | 1 + .../commonUI/edit/src/actions/SaveAction.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index ed3726af06..d89716e02e 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -94,6 +94,7 @@ define( newObject = parentObject.useCapability('instantiation', newModel); editableObject = new EditableDomainObject(newObject, this.$q); editableObject.setOriginalObject(parentObject); + editableObject.getCapability('status').set('editing', true); editableObject.useCapability('mutation', function(model){ model.location = parentObject.getId(); }); diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 3cda01129c..13543beac8 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -102,11 +102,6 @@ define( return domainObject; } - function doNothing() { - // Create cancelled, do nothing - return false; - } - function getAllComposees(domainObject){ return domainObject.useCapability('composition'); } @@ -134,12 +129,12 @@ define( return self.dialogService .getUserInput(wizard.getFormStructure(), wizard.getInitialFormValue()) - .then(buildObjectFromInput, doNothing); + .then(buildObjectFromInput); } function persistObject(object){ - return ((object.hasCapability('editor') && object.getCapability('editor').save(true)) || + return ((object.hasCapability('editor') && object.getCapability('editor').save(true)) || object.getCapability('persistence').persist()) .then(resolveWith(object)); } @@ -159,6 +154,11 @@ define( return parent; } + function doNothing() { + // Create cancelled, do nothing + return false; + } + // Invoke any save behavior introduced by the editor capability; // this is introduced by EditableDomainObject which is // used to insulate underlying objects from changes made @@ -177,7 +177,8 @@ define( .then(persistObject) .then(function(){ return fetchObject(domainObject.getId()); - }); + }) + .catch(doNothing) } else { return domainObject.getCapability("editor").save() .then(resolveWith(domainObject.getOriginalObject()));