From 708aa7dcba8f8793e1a0c514dc2ff332f46a888b Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 9 Dec 2015 20:37:15 -0800 Subject: [PATCH] Updated check for edit mode on create --- .../commonUI/browse/src/creation/CreateAction.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index 77a612da15..c9bca634ef 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -67,6 +67,19 @@ define( this.$q = $q; } + // Get a count of views which are not flagged as non-editable. + function countEditableViews(domainObject) { + var views = domainObject && domainObject.useCapability('view'), + count = 0; + + // A view is editable unless explicitly flagged as not + (views || []).forEach(function (view) { + count += (view.editable !== false) ? 1 : 0; + }); + + return count; + } + /** * Create a new object of the given type. * This will prompt for user input first. @@ -85,7 +98,7 @@ define( model.location = parentObject.getId(); }); - if (newObject.hasCapability('composition') && this.type.getKey()!=='folder') { + if (countEditableViews(editableObject) > 0) { this.navigationService.setNavigation(editableObject); } else { return editableObject.getCapability('action').perform('save');