From d0183d44c9f90f8fc56d5a75ce473078de44ac81 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Fri, 21 Aug 2015 13:04:47 -0700 Subject: [PATCH 1/8] [Actions] Remove Action When an ascendant or parent or currently selected object is removed the user is navigated to the parent of the object being removed. Added variables to RemoveAction test to test removing currently selected domainObject. --- platform/commonUI/edit/bundle.json | 2 +- .../commonUI/edit/src/actions/RemoveAction.js | 41 +++++++++++++++---- .../edit/test/actions/RemoveActionSpec.js | 37 +++++++++++++++-- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index 2aed41c2ee..c216a9d877 100644 --- a/platform/commonUI/edit/bundle.json +++ b/platform/commonUI/edit/bundle.json @@ -59,7 +59,7 @@ "glyph": "Z", "name": "Remove", "description": "Remove this object from its containing object.", - "depends": [ "$q" ] + "depends": [ "$q", "navigationService" ] }, { "key": "save", diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index fbf47d22d9..e89ad3ed2d 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -40,8 +40,9 @@ define( * @constructor * @memberof module:editor/actions/remove-action */ - function RemoveAction($q, context) { - var object = (context || {}).domainObject; + function RemoveAction($q, navigationService, context) { + var object = (context || {}).domainObject, + ROOT_ID = "ROOT"; /** * Check whether an object ID matches the ID of the object being @@ -68,15 +69,39 @@ define( var persistence = domainObject.getCapability('persistence'); return persistence && persistence.persist(); } - + + // Checks current object and ascendants of current + // object with object being removed, if the current + // object or any in the current object's path is being removed, + // navigate back to parent of removed object. + function checkObjectNavigation(object, parentObject) { + // Traverse object starts at current location + var traverseObject = navigationService.getNavigation(); + + // Stop at ROOT of folder path + while(traverseObject.getId() !== ROOT_ID) { + // If traverse object is object being removed + // navigate to parent of removed object + if (traverseObject.getId() === object.getId()) { + navigationService.setNavigation(parentObject); + return; + } + // Traverses to parent + traverseObject = traverseObject.getCapability('context').getParent(); + } + } + /** * Remove the object from its parent, as identified by its context * capability. - * @param {ContextCapability} contextCapability the "context" capability - * of the domain object being removed. + * @param {object} domain object being removed contextCapability + gotten from the "context" capability of this object */ - function removeFromContext(contextCapability) { - var parent = contextCapability.getParent(); + function removeFromContext(object) { + var contextCapability = object.getCapability('context'), + parent = contextCapability.getParent(); + // Navigates through/ascendant if deleting current object + checkObjectNavigation(object, parent) $q.when( parent.useCapability('mutation', doMutate) ).then(function () { @@ -91,7 +116,7 @@ define( * fulfilled when the action has completed. */ perform: function () { - return $q.when(object.getCapability('context')) + return $q.when(object) .then(removeFromContext); } }; diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index d23542f0ee..072094ed1d 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -28,8 +28,10 @@ define( describe("The Remove action", function () { var mockQ, + mockNavigationService, mockDomainObject, mockParent, + mockGrandparent, mockContext, mockMutation, mockPersistence, @@ -55,6 +57,20 @@ define( [ "getId", "getCapability" ] ); mockQ = { when: mockPromise }; + mockGrandparent = { + getModel: function () { + return model; + }, + getCapability: function (k) { + return capabilities[k]; + }, + useCapability: function (k, v) { + return capabilities[k].invoke(v); + }, + getId: function () { + return "test"; + } + }; mockParent = { getModel: function () { return model; @@ -64,31 +80,44 @@ define( }, useCapability: function (k, v) { return capabilities[k].invoke(v); + }, + getParent: function () { + return mockGrandparent; } }; mockContext = jasmine.createSpyObj("context", [ "getParent" ]); mockMutation = jasmine.createSpyObj("mutation", [ "invoke" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); - + mockNavigationService = jasmine.createSpyObj( + "navigationService", + [ + "getNavigation", + "setNavigation", + "addListener", + "removeListener" + ] + ); + mockNavigationService.getNavigation.andReturn(mockDomainObject); + + mockDomainObject.getId.andReturn("test"); mockDomainObject.getCapability.andReturn(mockContext); mockContext.getParent.andReturn(mockParent); mockType.hasFeature.andReturn(true); - capabilities = { mutation: mockMutation, persistence: mockPersistence, type: mockType }; model = { - composition: [ "a", "test", "b", "c" ] + composition: [ "a", "b", "test", "c" ] }; actionContext = { domainObject: mockDomainObject }; - action = new RemoveAction(mockQ, actionContext); + action = new RemoveAction(mockQ, mockNavigationService, actionContext); }); it("only applies to objects with parents", function () { From a507557cecd3ac924859dc0f205af4ae29349352 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Wed, 26 Aug 2015 10:07:51 -0700 Subject: [PATCH 2/8] [Remove] Remove Action Tweaked remove action to return on finding the object that is being removed and checking if it can be navigated to. Also completed tests for RemoveAction. --- .../commonUI/edit/src/actions/RemoveAction.js | 58 ++++++------ .../edit/test/actions/RemoveActionSpec.js | 91 +++++++++++++++---- 2 files changed, 101 insertions(+), 48 deletions(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index e89ad3ed2d..21c290cd08 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -37,23 +37,37 @@ define( * * @param {DomainObject} object the object to be removed * @param {ActionContext} context the context in which this action is performed + * @memberof platform/commonUI/edit * @constructor - * @memberof module:editor/actions/remove-action + * @implements {Action} */ function RemoveAction($q, navigationService, context) { - var object = (context || {}).domainObject, + this.domainObject = (context || {}).domainObject; + this.$q = $q; + this.navigationService = navigationService; + } + + /** + * Perform this action. + * @return {Promise} a promise which will be + * fulfilled when the action has completed. + */ + RemoveAction.prototype.perform = function () { + var $q = this.$q, + navigationService = this.navigationService, + domainObject = this.domainObject, ROOT_ID = "ROOT"; - /** + /* * Check whether an object ID matches the ID of the object being * removed (used to filter a parent's composition to handle the * removal.) */ function isNotObject(otherObjectId) { - return otherObjectId !== object.getId(); + return otherObjectId !== domainObject.getId(); } - /** + /* * Mutate a parent object such that it no longer contains the object * which is being removed. */ @@ -61,7 +75,7 @@ define( model.composition = model.composition.filter(isNotObject); } - /** + /* * Invoke persistence on a domain object. This will be called upon * the removed object's parent (as its composition will have changed.) */ @@ -76,10 +90,10 @@ define( // navigate back to parent of removed object. function checkObjectNavigation(object, parentObject) { // Traverse object starts at current location - var traverseObject = navigationService.getNavigation(); + var traverseObject = (navigationService).getNavigation(); // Stop at ROOT of folder path - while(traverseObject.getId() !== ROOT_ID) { + while (traverseObject.getId() !== ROOT_ID) { // If traverse object is object being removed // navigate to parent of removed object if (traverseObject.getId() === object.getId()) { @@ -90,37 +104,25 @@ define( traverseObject = traverseObject.getCapability('context').getParent(); } } - - /** + + /* * Remove the object from its parent, as identified by its context * capability. - * @param {object} domain object being removed contextCapability - gotten from the "context" capability of this object */ function removeFromContext(object) { var contextCapability = object.getCapability('context'), parent = contextCapability.getParent(); - // Navigates through/ascendant if deleting current object - checkObjectNavigation(object, parent) - $q.when( + checkObjectNavigation(object, parent); + return $q.when( parent.useCapability('mutation', doMutate) ).then(function () { return doPersist(parent); }); } - return { - /** - * Perform this action. - * @return {module:core/promises.Promise} a promise which will be - * fulfilled when the action has completed. - */ - perform: function () { - return $q.when(object) - .then(removeFromContext); - } - }; - } + return $q.when(domainObject) + .then(removeFromContext); + }; // Object needs to have a parent for Remove to be applicable RemoveAction.appliesTo = function (context) { @@ -138,4 +140,4 @@ define( return RemoveAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index 072094ed1d..0a93ffa180 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -31,8 +31,11 @@ define( mockNavigationService, mockDomainObject, mockParent, - mockGrandparent, + mockChildObject, + mockGrandchildObject, mockContext, + mockChildContext, + mockGrandchildContext, mockMutation, mockPersistence, mockType, @@ -56,21 +59,15 @@ define( "domainObject", [ "getId", "getCapability" ] ); + mockChildObject = jasmine.createSpyObj( + "domainObject", + [ "getId", "getCapability" ] + ); + mockGrandchildObject = jasmine.createSpyObj( + "domainObject", + [ "getId", "getCapability" ] + ); mockQ = { when: mockPromise }; - mockGrandparent = { - getModel: function () { - return model; - }, - getCapability: function (k) { - return capabilities[k]; - }, - useCapability: function (k, v) { - return capabilities[k].invoke(v); - }, - getId: function () { - return "test"; - } - }; mockParent = { getModel: function () { return model; @@ -80,12 +77,11 @@ define( }, useCapability: function (k, v) { return capabilities[k].invoke(v); - }, - getParent: function () { - return mockGrandparent; } }; mockContext = jasmine.createSpyObj("context", [ "getParent" ]); + mockChildContext = jasmine.createSpyObj("context", [ "getParent" ]); + mockGrandchildContext = jasmine.createSpyObj("context", [ "getParent" ]); mockMutation = jasmine.createSpyObj("mutation", [ "invoke" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); @@ -112,7 +108,7 @@ define( type: mockType }; model = { - composition: [ "a", "b", "test", "c" ] + composition: [ "a", "test", "b" ] }; actionContext = { domainObject: mockDomainObject }; @@ -152,11 +148,66 @@ define( // Should have removed "test" - that was our // mock domain object's id. - expect(result.composition).toEqual(["a", "b", "c"]); + expect(result.composition).toEqual(["a", "b"]); // Finally, should have persisted expect(mockPersistence.persist).toHaveBeenCalled(); }); + + it("removes parent of object currently navigated to", function () { + var mutator, result; + + // Navigates to child object + mockNavigationService.getNavigation.andReturn(mockChildObject); + + // Test is id of object being removed + // Child object has different id + mockDomainObject.getId.andReturn("test"); + mockChildObject.getId.andReturn("not test"); + + // Sets context for the child and domainObject + mockDomainObject.getCapability.andReturn(mockContext); + mockChildObject.getCapability.andReturn(mockChildContext); + + // Parents of child and domainObject are set + mockContext.getParent.andReturn(mockParent); + mockChildContext.getParent.andReturn(mockDomainObject); + + mockType.hasFeature.andReturn(true); + + action.perform(); + + // Expects navigation to parent of domainObject (removed object) + expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(mockParent); + }); + + it("checks if removing object not in ascendent path (reaches ROOT)", function () { + // Navigates to grandchild of ROOT + mockNavigationService.getNavigation.andReturn(mockGrandchildObject); + + // domainObject (grandparent) is set as ROOT, child and grandchild + // are set objects not being removed + mockDomainObject.getId.andReturn("ROOT"); + mockChildObject.getId.andReturn("not test"); + mockGrandchildObject.getId.andReturn("not test"); + + // Sets context for the grandchild, child, and domainObject + mockDomainObject.getCapability.andReturn(mockContext); + mockChildObject.getCapability.andReturn(mockChildContext); + mockGrandchildObject.getCapability.andReturn(mockGrandchildContext); + + // Parents of grandchild, child, and domainObject are set + mockContext.getParent.andReturn(mockParent); + mockChildContext.getParent.andReturn(mockDomainObject); + mockGrandchildContext.getParent.andReturn(mockChildObject); + + mockType.hasFeature.andReturn(true); + + action.perform(); + + // Expects no navigation to occur + expect(mockNavigationService.setNavigation).not.toHaveBeenCalled(); + }); }); } From 2cd1907b71b8359879621e18224ce29b562daebe Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 26 Aug 2015 13:40:22 -0700 Subject: [PATCH 3/8] [Search] Temporarily hide link icons Hide link icons in search results to temporarily fix issue #84. --- platform/commonUI/general/res/css/tree.css | 19 ++++++++++--------- .../general/res/sass/search/_search.scss | 3 +++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 93414d5dc1..bf2792ad0c 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -447,6 +447,7 @@ ul.tree { color: #fff; } /* line 287, ../sass/search/_search.scss */ .search .search-scroll .results .search-result-item .label .type-icon .l-icon-link { + display: none; text-shadow: black 0 1px 2px; z-index: 2; color: #49dedb; @@ -455,37 +456,37 @@ ul.tree { height: 8px; width: 8px; margin-left: -25px; } - /* line 296, ../sass/search/_search.scss */ + /* line 299, ../sass/search/_search.scss */ .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 299, ../sass/search/_search.scss */ + /* line 302, ../sass/search/_search.scss */ .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 302, ../sass/search/_search.scss */ + /* line 305, ../sass/search/_search.scss */ .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 310, ../sass/search/_search.scss */ + /* line 313, ../sass/search/_search.scss */ .search .search-scroll .load-icon { position: relative; } - /* line 312, ../sass/search/_search.scss */ + /* line 315, ../sass/search/_search.scss */ .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 316, ../sass/search/_search.scss */ + /* line 319, ../sass/search/_search.scss */ .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 326, ../sass/search/_search.scss */ + /* line 329, ../sass/search/_search.scss */ .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 331, ../sass/search/_search.scss */ + /* line 334, ../sass/search/_search.scss */ .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 336, ../sass/search/_search.scss */ + /* line 339, ../sass/search/_search.scss */ .search .search-scroll .load-more-button { margin-top: 5px 0; font-size: 0.8em; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index ce9286e947..079777cc66 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -285,6 +285,9 @@ } .label .type-icon .l-icon-link { + // Hide links for now. See GitHub issue #84. + display: none; + @include txtShdwSubtle(1); z-index: 2; @include ancillaryIcon(8px, $colorIconLink); From c4c4c42415da0d456eedfd58471cad3ff8315b02 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 27 Aug 2015 09:11:20 -0700 Subject: [PATCH 4/8] [Elastic] Elastic Bundle Elasticsearch bundle.json reverted back to original. --- platform/persistence/elastic/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/persistence/elastic/bundle.json b/platform/persistence/elastic/bundle.json index 8f5cd8cfec..f78d8504f2 100644 --- a/platform/persistence/elastic/bundle.json +++ b/platform/persistence/elastic/bundle.json @@ -23,7 +23,7 @@ }, { "key": "ELASTIC_ROOT", - "value": "/elastic", + "value": "http://localhost:9200", "priority": "fallback" }, { From dadbf3f6dc52565a76cbcf5f0de328156523b208 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 27 Aug 2015 09:17:11 -0700 Subject: [PATCH 5/8] [Action] RemoveAction Checks if the object exists, instead of checking if the ROOT is specifically reached, when traversing up to ancestors. --- platform/commonUI/edit/src/actions/RemoveAction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index fccce69b53..f49a998bb1 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -92,7 +92,7 @@ define( var traverseObject = (navigationService).getNavigation(); // Stop at ROOT of folder path - while (traverseObject.getId() !== ROOT_ID) { + while (traverseObject) { // If traverse object is object being removed // navigate to parent of removed object if (traverseObject.getId() === object.getId()) { From 3ec4cc099baaa7813c1ed2731774f6c1394d443c Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 27 Aug 2015 09:41:00 -0700 Subject: [PATCH 6/8] [Action] RemoveAction Adjusted unit tests for checking if traverseObject is undefined. Also removed unnecessary ROOT_ID variable. --- .../commonUI/edit/src/actions/RemoveAction.js | 3 +-- .../edit/test/actions/RemoveActionSpec.js | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index f49a998bb1..9be6f00821 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -55,8 +55,7 @@ define( RemoveAction.prototype.perform = function () { var $q = this.$q, navigationService = this.navigationService, - domainObject = this.domainObject, - ROOT_ID = "ROOT"; + domainObject = this.domainObject; /* * Check whether an object ID matches the ID of the object being * removed (used to filter a parent's composition to handle the diff --git a/platform/commonUI/edit/test/actions/RemoveActionSpec.js b/platform/commonUI/edit/test/actions/RemoveActionSpec.js index 0a93ffa180..116627c87d 100644 --- a/platform/commonUI/edit/test/actions/RemoveActionSpec.js +++ b/platform/commonUI/edit/test/actions/RemoveActionSpec.js @@ -33,9 +33,11 @@ define( mockParent, mockChildObject, mockGrandchildObject, + mockRootObject, mockContext, mockChildContext, mockGrandchildContext, + mockRootContext, mockMutation, mockPersistence, mockType, @@ -67,6 +69,10 @@ define( "domainObject", [ "getId", "getCapability" ] ); + mockRootObject = jasmine.createSpyObj( + "domainObject", + [ "getId", "getCapability" ] + ); mockQ = { when: mockPromise }; mockParent = { getModel: function () { @@ -82,6 +88,7 @@ define( mockContext = jasmine.createSpyObj("context", [ "getParent" ]); mockChildContext = jasmine.createSpyObj("context", [ "getParent" ]); mockGrandchildContext = jasmine.createSpyObj("context", [ "getParent" ]); + mockRootContext = jasmine.createSpyObj("context", [ "getParent" ]); mockMutation = jasmine.createSpyObj("mutation", [ "invoke" ]); mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]); mockType = jasmine.createSpyObj("type", [ "hasFeature" ]); @@ -155,8 +162,6 @@ define( }); it("removes parent of object currently navigated to", function () { - var mutator, result; - // Navigates to child object mockNavigationService.getNavigation.andReturn(mockChildObject); @@ -187,18 +192,18 @@ define( // domainObject (grandparent) is set as ROOT, child and grandchild // are set objects not being removed - mockDomainObject.getId.andReturn("ROOT"); - mockChildObject.getId.andReturn("not test"); - mockGrandchildObject.getId.andReturn("not test"); + mockDomainObject.getId.andReturn("test 1"); + mockRootObject.getId.andReturn("ROOT"); + mockChildObject.getId.andReturn("not test 2"); + mockGrandchildObject.getId.andReturn("not test 3"); // Sets context for the grandchild, child, and domainObject - mockDomainObject.getCapability.andReturn(mockContext); + mockRootObject.getCapability.andReturn(mockRootContext); mockChildObject.getCapability.andReturn(mockChildContext); mockGrandchildObject.getCapability.andReturn(mockGrandchildContext); - // Parents of grandchild, child, and domainObject are set - mockContext.getParent.andReturn(mockParent); - mockChildContext.getParent.andReturn(mockDomainObject); + // Parents of grandchild and child are set + mockChildContext.getParent.andReturn(mockRootObject); mockGrandchildContext.getParent.andReturn(mockChildObject); mockType.hasFeature.andReturn(true); From 687d86790eef8afec3a862d5369ee43efec9db05 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 27 Aug 2015 09:49:26 -0700 Subject: [PATCH 7/8] [Action] RemoveAction Added comments regarding change in checking of traversed objects. --- .../commonUI/edit/src/actions/RemoveAction.js | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index 9be6f00821..2d8e224491 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -82,35 +82,44 @@ define( return persistence && persistence.persist(); } - // Checks current object and ascendants of current - // object with object being removed, if the current - // object or any in the current object's path is being removed, - // navigate back to parent of removed object. + /* + * Checks current object and ascendants of current + * object with object being removed, if the current + * object or any in the current object's path is being removed, + * navigate back to parent of removed object. + */ function checkObjectNavigation(object, parentObject) { // Traverse object starts at current location var traverseObject = (navigationService).getNavigation(); - // Stop at ROOT of folder path + // Stop when object is not defined (above ROOT) while (traverseObject) { - // If traverse object is object being removed - // navigate to parent of removed object + + // If object currently traversed to is object being removed + // navigate to parent of current object and then exit loop if (traverseObject.getId() === object.getId()) { navigationService.setNavigation(parentObject); return; } - // Traverses to parent + // Traverses to parent of current object, moving + // up the ascendant path traverseObject = traverseObject.getCapability('context').getParent(); } } /* * Remove the object from its parent, as identified by its context - * capability. + * capability. Based on object's location and selected object's location + * user may be navigated to existing parent object */ function removeFromContext(object) { var contextCapability = object.getCapability('context'), parent = contextCapability.getParent(); + + // If currently within path of removed object(s), + // navigates to existing object up tree checkObjectNavigation(object, parent); + return $q.when( parent.useCapability('mutation', doMutate) ).then(function () { From 63b41d796a2881bda72398cc78f693ab51ba30d6 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 27 Aug 2015 12:06:25 -0700 Subject: [PATCH 8/8] [Mobile] Clean Up Cleaned up context menu gesture comments with spacing. --- platform/representation/src/gestures/ContextMenuGesture.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index 158c209beb..4de40586dd 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -55,14 +55,17 @@ define( // When context menu event occurs, show object actions instead if (!agentService.isMobile(navigator.userAgent)) { + // When context menu event occurs, show object actions instead element.on('contextmenu', showMenu); } else if (agentService.isMobile(navigator.userAgent)) { + // If on mobile device, then start timeout for the single touch event // during the timeout 'isPressing' is true. element.on('touchstart', function (event) { if (event.touches.length < 2) { isPressing = true; + // After the timeout, if 'isPressing' is // true, display context menu for object $timeout(function () { @@ -72,6 +75,7 @@ define( }, longTouchTime); } }); + // Whenever the touch event ends, 'isPressing' is false. element.on('touchend', function (event) { isPressing = false;