Added save/cancel
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
"implementation": "actions/SaveAction.js",
|
||||
"name": "Save",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ],
|
||||
"depends": [ "$location", "urlService", "navigationService" ],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
@@ -76,7 +76,7 @@
|
||||
"implementation": "actions/CancelAction.js",
|
||||
"name": "Cancel",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ]
|
||||
"depends": [ "$location", "urlService", "navigationService" ]
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
|
||||
@@ -33,10 +33,11 @@ define(
|
||||
* @memberof platform/commonUI/edit
|
||||
* @implements {Action}
|
||||
*/
|
||||
function CancelAction($location, urlService, context) {
|
||||
function CancelAction($location, urlService, navigationService, context) {
|
||||
this.domainObject = context.domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,8 @@ define(
|
||||
CancelAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
urlService = this.urlService,
|
||||
self = this;
|
||||
|
||||
// Look up the object's "editor.completion" capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@@ -67,10 +69,11 @@ define(
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
function returnToBrowse() {
|
||||
$location.path($location.path(urlService.urlForLocation(
|
||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
/*$location.path($location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
)));
|
||||
)));*/
|
||||
}
|
||||
|
||||
return doCancel(getEditorCapability())
|
||||
|
||||
@@ -34,10 +34,11 @@ define(
|
||||
* @implements {Action}
|
||||
* @memberof platform/commonUI/edit
|
||||
*/
|
||||
function SaveAction($location, urlService, context) {
|
||||
function SaveAction($location, urlService, navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +51,8 @@ define(
|
||||
SaveAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
urlService = this.urlService,
|
||||
self = this;
|
||||
|
||||
// Invoke any save behavior introduced by the editor capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@@ -61,12 +63,14 @@ define(
|
||||
}
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
// UI, which will have been pushed atop the Browse UI.)
|
||||
function returnToBrowse() {
|
||||
return $location.path(urlService.urlForLocation(
|
||||
|
||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
/*return $location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
));
|
||||
));*/
|
||||
}
|
||||
|
||||
return doSave().then(returnToBrowse);
|
||||
|
||||
Reference in New Issue
Block a user