Resolved merge conflicts
This commit is contained in:
@@ -34,6 +34,7 @@ define(
|
|||||||
* from context menu of non-editable objects, when navigated object
|
* from context menu of non-editable objects, when navigated object
|
||||||
* is being edited
|
* is being edited
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @implements {Policy.<Action, ActionContext>}
|
||||||
*/
|
*/
|
||||||
function EditContextualActionPolicy(navigationService, editModeBlacklist, nonEditContextBlacklist) {
|
function EditContextualActionPolicy(navigationService, editModeBlacklist, nonEditContextBlacklist) {
|
||||||
this.navigationService = navigationService;
|
this.navigationService = navigationService;
|
||||||
@@ -45,22 +46,18 @@ define(
|
|||||||
this.nonEditContextBlacklist = nonEditContextBlacklist;
|
this.nonEditContextBlacklist = nonEditContextBlacklist;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isParentEditable(object) {
|
|
||||||
var parent = object.hasCapability("context") && object.getCapability("context").getParent();
|
|
||||||
return !!parent && parent.hasCapability("editor");
|
|
||||||
}
|
|
||||||
|
|
||||||
EditContextualActionPolicy.prototype.allow = function (action, context) {
|
EditContextualActionPolicy.prototype.allow = function (action, context) {
|
||||||
var selectedObject = context.domainObject,
|
var selectedObject = context.domainObject,
|
||||||
navigatedObject = this.navigationService.getNavigation(),
|
navigatedObject = this.navigationService.getNavigation(),
|
||||||
actionMetadata = action.getMetadata ? action.getMetadata() : {};
|
actionMetadata = action.getMetadata ? action.getMetadata() : {};
|
||||||
|
|
||||||
if (navigatedObject.hasCapability('editor')) {
|
if (navigatedObject.getCapability("status").get("editing")) {
|
||||||
if (selectedObject.hasCapability('editor') || isParentEditable(selectedObject)){
|
if (selectedObject.hasCapability("editor") && selectedObject.getCapability("editor").inEditContext()){
|
||||||
return this.editModeBlacklist.indexOf(actionMetadata.key) === -1;
|
//Target is within the editing context
|
||||||
|
return this.editBlacklist.indexOf(actionMetadata.key) === -1;
|
||||||
} else {
|
} else {
|
||||||
//Target is in the context menu
|
//Target is not within the editing context
|
||||||
return this.nonEditContextBlacklist.indexOf(actionMetadata.key) === -1;
|
return this.nonEditBlacklist.indexOf(actionMetadata.key) === -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user