[Common UI] Add JSDoc for CreateMenuController

Add JSDoc and clarifying comments to the CreateMenuController,
which is responsible for maintaining an up-to-date set of
Create actions for a given domain object. WTD-574.
This commit is contained in:
Victor Woeltjen
2014-11-24 07:20:49 -08:00
parent 6e9d6e2199
commit 845c1ad7d7

View File

@@ -9,18 +9,26 @@ define(
"use strict"; "use strict";
/** /**
* Controller for the Create menu; maintains an up-to-date
* set of Create actions based on the currently-selected
* domain object.
* *
* @constructor * @constructor
*/ */
function CreateMenuController($scope) { function CreateMenuController($scope) {
// Update the set of Create actions
function refreshActions() { function refreshActions() {
var actionCapability = $scope.action; $scope.createActions = $scope.action ?
if (actionCapability) { $scope.action.getActions('create') :
$scope.createActions = [];
actionCapability.getActions('create');
}
} }
// Listen for new instances of the represented object's
// "action" capability. This is provided by the mct-representation
// for the Create button.
// A watch is needed here (instead of invoking action.getActions
// directly) because different action instances may be returned
// with each call.
$scope.$watch("action", refreshActions); $scope.$watch("action", refreshActions);
} }