mirror of
https://github.com/nasa/openmct.git
synced 2025-04-20 17:11:11 +00:00
[Treeview] Open in new tab settings
When an object is opened in a new tab, the left pane will be closed by default. Otherwise it will be open by default. #72.
This commit is contained in:
parent
503c8e2f03
commit
79529e4879
@ -21,7 +21,7 @@
|
||||
{
|
||||
"key": "BrowseObjectController",
|
||||
"implementation": "BrowseObjectController.js",
|
||||
"depends": [ "$scope", "$location", "$route" ]
|
||||
"depends": [ "$scope", "$location", "$route", "$window" ]
|
||||
},
|
||||
{
|
||||
"key": "CreateMenuController",
|
||||
|
@ -31,7 +31,7 @@ define(
|
||||
* object (the right-hand side of Browse mode.)
|
||||
* @constructor
|
||||
*/
|
||||
function BrowseObjectController($scope, $location, $route) {
|
||||
function BrowseObjectController($scope, $location, $route, $window) {
|
||||
function setViewForDomainObject(domainObject) {
|
||||
var locationViewKey = $location.search().view;
|
||||
|
||||
@ -64,7 +64,15 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ngModel.leftPane = true;
|
||||
// If there is a defined opener, assume that the window was opened
|
||||
// by choosing 'Open in a new tab'
|
||||
if ($window.opener) {
|
||||
// The desired default for this is to have a closed left pane
|
||||
$scope.ngModel.leftPane = false;
|
||||
} else {
|
||||
// Otherwise, start the application with an open left pane
|
||||
$scope.ngModel.leftPane = true;
|
||||
}
|
||||
|
||||
$scope.$watch('domainObject', setViewForDomainObject);
|
||||
$scope.$watch('representation.selected.key', updateQueryParam);
|
||||
|
@ -31,6 +31,7 @@ define(
|
||||
var mockScope,
|
||||
mockLocation,
|
||||
mockRoute,
|
||||
mockWindow,
|
||||
mockUnlisten,
|
||||
controller;
|
||||
|
||||
@ -50,6 +51,7 @@ define(
|
||||
);
|
||||
mockScope.ngModel = {};
|
||||
mockRoute = { current: { params: {} } };
|
||||
mockWindow = {};
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
[ "path", "search" ]
|
||||
@ -61,7 +63,8 @@ define(
|
||||
controller = new BrowseObjectController(
|
||||
mockScope,
|
||||
mockLocation,
|
||||
mockRoute
|
||||
mockRoute,
|
||||
mockWindow
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user