From a399b78d2c542cf31a38fd4a7f8e9995a968e496 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 9 Dec 2015 18:39:57 -0800 Subject: [PATCH] Fixed JSLint errors --- .../capabilities/EditableActionCapability.js | 2 +- .../src/gestures/DropGesture.js | 50 +++++++++---------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js index d7bbf48274..b26b3bba99 100644 --- a/platform/commonUI/edit/src/capabilities/EditableActionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableActionCapability.js @@ -48,7 +48,7 @@ define( action.getActions = function(domainObject) { return actionCapability.getActions(domainObject).filter(function(action){ - return !(DISALLOWED_ACTIONS.indexOf(action.getMetadata().key) >= 0); + return DISALLOWED_ACTIONS.indexOf(action.getMetadata().key) >= 0 ? false : true; }); }; diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index e7fa2de3ab..0b5c0bf75a 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -128,8 +128,9 @@ define( model.type = typeKey; newPanel = new EditableDomainObject(instantiate(model, id), $q); - if (!canCompose(newPanel, selectedObject)) + if (!canCompose(newPanel, selectedObject)) { return undefined; + } [base.getId(), selectedObject.getId()].forEach(function(id){ newPanel.getCapability('composition').add(id); @@ -151,35 +152,30 @@ define( domainObjectType = editableDomainObject.getModel().type, selectedObject = dndService.getData( GestureConstants.MCT_EXTENDED_DRAG_TYPE - );; - - // If currently in edit mode allow drag and drop gestures to the - // domain object. An exception to this is folders which have drop - // gestures in browse mode. - //if (domainObjectType === 'folder' || domainObject.hasCapability('editor')) { + ); - // Handle the drop; add the dropped identifier to the - // destination domain object's composition, and persist - // the change. - if (id) { - if (shouldCreateVirtualPanel(domainObject, selectedObject)){ - if (editableDomainObject = createVirtualPanel(domainObject, selectedObject)) { - navigationService.setNavigation(editableDomainObject); - broadcastDrop(id, event); - editableDomainObject.getCapability('status').set('editing', true); - } - } else { - $q.when(action && action.perform()).then(function (result) { - //Don't go into edit mode for folders - if (domainObjectType!=='folder') { - navigationService.setNavigation(editableDomainObject); - } - broadcastDrop(id, event); - editableDomainObject.getCapability('status').set('editing', true); - }); + // Handle the drop; add the dropped identifier to the + // destination domain object's composition, and persist + // the change. + if (id) { + if (shouldCreateVirtualPanel(domainObject, selectedObject)){ + editableDomainObject = createVirtualPanel(domainObject, selectedObject); + if (editableDomainObject) { + navigationService.setNavigation(editableDomainObject); + broadcastDrop(id, event); + editableDomainObject.getCapability('status').set('editing', true); } + } else { + $q.when(action && action.perform()).then(function (result) { + //Don't go into edit mode for folders + if (domainObjectType!=='folder') { + navigationService.setNavigation(editableDomainObject); + } + broadcastDrop(id, event); + editableDomainObject.getCapability('status').set('editing', true); + }); } - //} + } // TODO: Alert user if drag and drop is not allowed }