Merge remote-tracking branch 'origin/open788' into open-master

This commit is contained in:
bwyu
2015-03-10 12:41:08 -07:00
11 changed files with 163 additions and 13 deletions

View File

@@ -4,7 +4,7 @@
* Module defining EditController. Created by vwoeltje on 11/14/14.
*/
define(
["./objects/EditableDomainObject"],
["../objects/EditableDomainObject"],
function (EditableDomainObject) {
"use strict";

View File

@@ -0,0 +1,47 @@
/*global define*/
define(
[],
function () {
"use strict";
/**
* Supports the Library and Elements panes in Edit mode.
* @constructor
*/
function EditPanesController($scope) {
var root;
// Update root object based on represented object
function updateRoot(domainObject) {
var context = domainObject &&
domainObject.getCapability('context'),
newRoot = context && context.getRoot(),
oldId = root && root.getId(),
newId = newRoot && newRoot.getId();
// Only update if this has actually changed,
// to avoid excessive refreshing.
if (oldId !== newId) {
root = newRoot;
}
}
// Update root when represented object changes
$scope.$watch('domainObject', updateRoot);
return {
/**
* Get the root-level domain object, as reported by the
* represented domain object.
* @returns {DomainObject} the root object
*/
getRoot: function () {
return root;
}
};
}
return EditPanesController;
}
);