[Common UI] Initial commonUI bundles

Bring in work on general-purpose and over-arching
user interface bundles from the sandbox transition
branch. WTD-574.
This commit is contained in:
Victor Woeltjen
2014-11-23 15:41:20 -08:00
parent 0cd331e8a5
commit 1b0303e517
73 changed files with 6035 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*global define,Promise*/
/**
* Module defining BrowseController. Created by vwoeltje on 11/7/14.
*/
define(
[],
function () {
"use strict";
var ROOT_OBJECT = "ROOT";
/**
*
* @constructor
*/
function BrowseController($scope, objectService, navigationService) {
function setNavigation(domainObject) {
$scope.navigatedObject = domainObject;
//$scope.$apply("navigatedObject");
}
objectService.getObjects([ROOT_OBJECT]).then(function (objects) {
var composition = objects[ROOT_OBJECT].useCapability("composition");
$scope.domainObject = objects[ROOT_OBJECT];
if (composition) {
composition.then(function (c) {
// Navigate to the last root level component (usually "mine")
if (!navigationService.getNavigation()) {
navigationService.setNavigation(c[c.length - 1]);
} else {
$scope.navigatedObject = navigationService.getNavigation();
}
});
}
});
$scope.$on("$destroy", function () {
navigationService.removeListener(setNavigation);
});
navigationService.addListener(setNavigation);
return {
setNavigation: function (domainObject) {
navigationService.setNavigation(domainObject);
}
};
}
return BrowseController;
}
);