[Edit Mode] Fixed issue with save dialog not being displayed for new objects after mutation. Fixes 1080

This commit is contained in:
Henry
2016-09-21 16:12:09 -07:00
parent e0b6986851
commit 3548cde9c4
5 changed files with 69 additions and 23 deletions

View File

@ -48,20 +48,34 @@ define(
*/
NavigateAction.prototype.perform = function () {
var self = this,
navigationAllowed = true;
navigateTo = this.domainObject,
currentObject = self.navigationService.getNavigation(),
editing = currentObject.hasCapability('editor') &&
currentObject.getCapability('editor').isEditContextRoot();
function allow() {
self.policyService.allow("navigation", self.navigationService.getNavigation(), self.domainObject, function (message) {
var navigationAllowed = true;
self.policyService.allow("navigation", currentObject, navigateTo, function (message) {
navigationAllowed = self.$window.confirm(message + "\r\n\r\n" +
" Are you sure you want to continue?");
});
return navigationAllowed;
}
// Set navigation, and wrap like a promise
return this.$q.when(
allow() && this.navigationService.setNavigation(this.domainObject)
);
function cancelIfEditing() {
return self.$q.when(editing && currentObject.getCapability("editor").cancel());
}
function navigate() {
return self.navigationService.setNavigation(navigateTo);
}
if (allow()) {
return cancelIfEditing().then(navigate);
} else {
return this.$q.when(false);
}
};
/**