mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
Reviewed edit mode checking
This commit is contained in:
@ -87,11 +87,10 @@ define(
|
|||||||
*/
|
*/
|
||||||
EditAction.appliesTo = function (context) {
|
EditAction.appliesTo = function (context) {
|
||||||
var domainObject = (context || {}).domainObject,
|
var domainObject = (context || {}).domainObject,
|
||||||
type = domainObject && domainObject.getCapability('type'),
|
type = domainObject && domainObject.getCapability('type');
|
||||||
isEditMode = domainObject && domainObject.getDomainObject ? true : false;
|
|
||||||
|
|
||||||
// Only allow creatable types to be edited
|
// Only allow creatable types to be edited
|
||||||
return type && type.hasFeature('creation') && !isEditMode;
|
return type && type.hasFeature('creation') && !domainObject.getCapability('status').get('editing');
|
||||||
};
|
};
|
||||||
|
|
||||||
return EditAction;
|
return EditAction;
|
||||||
|
@ -37,7 +37,7 @@ define(
|
|||||||
// If a view is flagged as non-editable, only allow it
|
// If a view is flagged as non-editable, only allow it
|
||||||
// while we're not in Edit mode.
|
// while we're not in Edit mode.
|
||||||
if ((view || {}).editable === false) {
|
if ((view || {}).editable === false) {
|
||||||
return !(domainObject.hasCapability('editor') && domainObject.getCapability('status').get('editing'));
|
return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like all policies, allow by default.
|
// Like all policies, allow by default.
|
||||||
|
@ -57,7 +57,8 @@ define(
|
|||||||
function storeZoom() {
|
function storeZoom() {
|
||||||
var isEditMode = $scope.commit &&
|
var isEditMode = $scope.commit &&
|
||||||
$scope.domainObject &&
|
$scope.domainObject &&
|
||||||
$scope.domainObject.hasCapability('editor');
|
$scope.domainObject.hasCapability('editor') &&
|
||||||
|
$scope.domainObject.getCapability('editor').inEditContext();
|
||||||
if (isEditMode) {
|
if (isEditMode) {
|
||||||
$scope.configuration = $scope.configuration || {};
|
$scope.configuration = $scope.configuration || {};
|
||||||
$scope.configuration.zoomLevel = zoomIndex;
|
$scope.configuration.zoomLevel = zoomIndex;
|
||||||
|
Reference in New Issue
Block a user