[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:
Victor Woeltjen
2015-02-26 17:05:13 -08:00
parent cb078e9620
commit 0d5a849a41
8 changed files with 10 additions and 10 deletions

View File

@ -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;
}
);

View 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;
}
);