[Fixed Position] Allow views to populate toolbar

Add a toolbar representer to share enough scope that
views become capable of populating toolbars. Needed
for toolbar of fixed position view, WTD-615.
This commit is contained in:
Victor Woeltjen 2015-01-15 17:04:03 -08:00
parent 61c3472266
commit 9d25359aa3
2 changed files with 47 additions and 3 deletions

View File

@ -2,13 +2,20 @@
mct-object="domainObject"
ng-model="representation">
</mct-representation>
<div class="holder edit-area outline abs">
<!-- edit toolbar goes here -->
<div class="holder edit-area outline abs"
ng-init="toolbar = {}">
<mct-toolbar name="mctToolbar"
structure="toolbar.structure"
ng-model="toolbar.state">
</mct-toolbar>
<div class='split-layout vertical contents abs work-area'>
<div class='abs pane left edit-main'>
<div class='holder abs object-holder'>
<mct-representation key="representation.selected.key"
mct-object="domainObject">
toolbar="toolbar"
mct-object="representation.selected.key && domainObject">
</mct-representation>
</div>
</div>

View File

@ -0,0 +1,37 @@
/*global define*/
define(
[],
function () {
function ToolbarRepresenter(scope, element, attrs) {
var parent = scope.$parent;
function represent(domainObject, representation) {
// New domain object, clear out the tool bar
parent.toolbar = {};
scope.toolbar = parent.toolbar;
}
return {
/**
* Set the current representation in use, and the domain
* object being represented.
*
* @param {RepresentationDefinition} representation the
* definition of the representation in use
* @param {DomainObject} domainObject the domain object
* being represented
*/
represent: represent,
/**
* Release any resources associated with this representer.
*/
destroy: function () {}
};
}
return ToolbarRepresenter;
}
);