mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 22:58:14 +00:00
[Edit] Restructure source folder
Restructure sources associated with Edit mode; work on WTD-788 has increased number of sources here so more organization is useful.
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining EditActionController. Created by vwoeltje on 11/17/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var ACTION_CONTEXT = { category: 'conclude-editing' };
|
||||
|
||||
/**
|
||||
* Controller which supplies action instances for Save/Cancel.
|
||||
* @constructor
|
||||
*/
|
||||
function EditActionController($scope) {
|
||||
// Maintain all "conclude-editing" actions in the present
|
||||
// context.
|
||||
function updateActions() {
|
||||
$scope.editActions = $scope.action ?
|
||||
$scope.action.getActions(ACTION_CONTEXT) :
|
||||
[];
|
||||
}
|
||||
|
||||
// Update set of actions whenever the action capability
|
||||
// changes or becomes available.
|
||||
$scope.$watch("action", updateActions);
|
||||
}
|
||||
|
||||
return EditActionController;
|
||||
}
|
||||
);
|
34
platform/commonUI/edit/src/controllers/EditController.js
Normal file
34
platform/commonUI/edit/src/controllers/EditController.js
Normal file
@ -0,0 +1,34 @@
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining EditController. Created by vwoeltje on 11/14/14.
|
||||
*/
|
||||
define(
|
||||
["../objects/EditableDomainObject"],
|
||||
function (EditableDomainObject) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Controller which is responsible for populating the scope for
|
||||
* Edit mode; introduces an editable version of the currently
|
||||
* navigated domain object into the scope.
|
||||
* @constructor
|
||||
*/
|
||||
function EditController($scope, navigationService) {
|
||||
function setNavigation(domainObject) {
|
||||
// Wrap the domain object such that all mutation is
|
||||
// confined to edit mode (until Save)
|
||||
$scope.navigatedObject =
|
||||
domainObject && new EditableDomainObject(domainObject);
|
||||
}
|
||||
|
||||
setNavigation(navigationService.getNavigation());
|
||||
navigationService.addListener(setNavigation);
|
||||
$scope.$on("$destroy", function () {
|
||||
navigationService.removeListener(setNavigation);
|
||||
});
|
||||
}
|
||||
|
||||
return EditController;
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user