[Code Style] Use prototypes in Edit bundle

WTD-1482.
This commit is contained in:
Victor Woeltjen
2015-08-10 16:38:13 -07:00
parent efc42aa8f2
commit be5cad212a
25 changed files with 766 additions and 790 deletions

View File

@ -30,30 +30,22 @@ define(
* Policy controlling which views should be visible in Edit mode.
* @memberof platform/commonUI/edit
* @constructor
* @implements {Policy.<View, DomainObject>}
*/
function EditableViewPolicy() {
return {
/**
* Check whether or not a given action is allowed by this
* policy.
* @param {Action} action the action
* @param domainObject the domain object which will be viewed
* @returns {boolean} true if not disallowed
* @memberof platform/commonUI/edit.EditableViewPolicy#
*/
allow: function (view, domainObject) {
// If a view is flagged as non-editable, only allow it
// while we're not in Edit mode.
if ((view || {}).editable === false) {
return !domainObject.hasCapability('editor');
}
// Like all policies, allow by default.
return true;
}
};
}
EditableViewPolicy.prototype.allow = function (view, domainObject) {
// If a view is flagged as non-editable, only allow it
// while we're not in Edit mode.
if ((view || {}).editable === false) {
return !domainObject.hasCapability('editor');
}
// Like all policies, allow by default.
return true;
};
return EditableViewPolicy;
}
);