Merge branch 'master' into persist-on-mutation-825

Conflicts:
	platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js
This commit is contained in:
Victor Woeltjen
2016-05-20 10:59:54 -07:00
11 changed files with 118 additions and 98 deletions

View File

@ -31,13 +31,14 @@ define(
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function LinkAction(context) {
function EditAndComposeAction(context) {
this.domainObject = (context || {}).domainObject;
this.selectedObject = (context || {}).selectedObject;
}
LinkAction.prototype.perform = function () {
var self = this;
EditAndComposeAction.prototype.perform = function () {
var self = this,
editAction = this.domainObject.getCapability('action').getActions("edit")[0];
// Link these objects
function doLink() {
@ -46,9 +47,13 @@ define(
return composition && composition.add(self.selectedObject);
}
if (editAction) {
editAction.perform();
}
return this.selectedObject && doLink();
};
return LinkAction;
return EditAndComposeAction;
}
);

View File

@ -81,17 +81,14 @@ define(
var key = action.getMetadata().key,
category = (context || {}).category;
// Only worry about actions in the view-control category
if (category === 'view-control') {
// Restrict 'edit' to cases where there are editable
// views (similarly, restrict 'properties' to when
// the converse is true), and where the domain object is not
// already being edited.
if (key === 'edit') {
return this.countEditableViews(context) > 0 && !isEditing(context);
} else if (key === 'properties') {
return this.countEditableViews(context) < 1 && !isEditing(context);
}
// Restrict 'edit' to cases where there are editable
// views (similarly, restrict 'properties' to when
// the converse is true), and where the domain object is not
// already being edited.
if (key === 'edit') {
return this.countEditableViews(context) > 0 && !isEditing(context);
} else if (key === 'properties' && category === 'view-control') {
return this.countEditableViews(context) < 1 && !isEditing(context);
}
// Like all policies, allow by default.