Fixed cancel and drop-initiated edit

This commit is contained in:
Henry 2015-11-20 13:59:32 -08:00
parent 4f0f9e4104
commit 7849803a5d
4 changed files with 6 additions and 10 deletions

View File

@ -76,6 +76,9 @@ define(
if (domainObject !== $scope.navigatedObject && isDirty() && !confirm(CONFIRM_MSG)) {
$scope.treeModel.selectedObject = $scope.navigatedObject;
} else {
if (domainObject !== $scope.navigatedObject && $scope.navigatedObject.hasCapability('editor')){
$scope.navigatedObject.getCapability('action').perform('cancel');
}
setNavigation(domainObject);
}
}
@ -163,15 +166,6 @@ define(
return hasChanges;
}
function beforeNavigateWarning (){
if (isDirty()) {
return false;
}
else {
return true;
}
}
$scope.beforeUnloadWarning = function() {
return isDirty() ?
"Unsaved changes will be lost if you leave this page." :

View File

@ -75,6 +75,7 @@ define(
var editableObject;
if (!this.domainObject.hasCapability("editor")) {
editableObject = new EditableDomainObject(this.domainObject, this.$q);
editableObject.getCapability('status').set('editing', true);
this.navigationService.setNavigation(editableObject);
}
//this.$location.path("/edit");

View File

@ -118,7 +118,6 @@ define(
cache = new EditableDomainObjectCache(EditableDomainObjectImpl, $q);
cachedObject = cache.getEditableObject(domainObject);
cachedObject.getCapability('status').set('editing', true);
return cachedObject;
}

View File

@ -137,6 +137,8 @@ define(
domainObjectType = editableDomainObject.getModel().type,
virtualObj;
editableDomainObject.getCapability('status').set('editing', true);
// 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.