From bb4ea2d4ae508776f1f8edf108ec860ddbc65379 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 18 Mar 2015 09:46:16 -0700 Subject: [PATCH] [Edit] Get to true root from EditPanesController Part of refactoring to hide objects outside of Edit mode from the Create menus in Edit mode, WTD-922. --- .../capabilities/EditableContextCapability.js | 18 +++++++++++------- .../src/controllers/EditPanesController.js | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js index 4880c0072e..afd46a003f 100644 --- a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js @@ -24,15 +24,19 @@ define( // This is a "lookup" style capability (it looks up other // domain objects), and it should be idempotent var capability = new EditableLookupCapability( - contextCapability, - editableObject, - domainObject, - cache, - true // Idempotent - ); + contextCapability, + editableObject, + domainObject, + cache, + true // Idempotent + ), + // Track the real root object for the Elements pane + trueRoot = capability.getRoot(); // Provide access to the real root, for the Elements pane. - capability.getTrueRoot = capability.getRoot; + capability.getTrueRoot = function () { + return trueRoot; + }; // Hide ancestry after the root of this subgraph if (cache.isRoot(domainObject)) { diff --git a/platform/commonUI/edit/src/controllers/EditPanesController.js b/platform/commonUI/edit/src/controllers/EditPanesController.js index 6962004b7f..433a90094e 100644 --- a/platform/commonUI/edit/src/controllers/EditPanesController.js +++ b/platform/commonUI/edit/src/controllers/EditPanesController.js @@ -16,7 +16,7 @@ define( function updateRoot(domainObject) { var context = domainObject && domainObject.getCapability('context'), - newRoot = context && context.getRealRoot(), + newRoot = context && context.getTrueRoot(), oldId = root && root.getId(), newId = newRoot && newRoot.getId();