mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 16:10:23 +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:
@ -21,7 +21,7 @@
|
|||||||
{
|
{
|
||||||
"key": "BrowseObjectController",
|
"key": "BrowseObjectController",
|
||||||
"implementation": "BrowseObjectController.js",
|
"implementation": "BrowseObjectController.js",
|
||||||
"depends": [ "$scope", "$location", "$route" ]
|
"depends": [ "$scope", "$location", "$route", "$window" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "CreateMenuController",
|
"key": "CreateMenuController",
|
||||||
|
@ -31,7 +31,7 @@ define(
|
|||||||
* object (the right-hand side of Browse mode.)
|
* object (the right-hand side of Browse mode.)
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function BrowseObjectController($scope, $location, $route) {
|
function BrowseObjectController($scope, $location, $route, $window) {
|
||||||
function setViewForDomainObject(domainObject) {
|
function setViewForDomainObject(domainObject) {
|
||||||
var locationViewKey = $location.search().view;
|
var locationViewKey = $location.search().view;
|
||||||
|
|
||||||
@ -64,7 +64,15 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.ngModel.leftPane = true;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.$watch('domainObject', setViewForDomainObject);
|
$scope.$watch('domainObject', setViewForDomainObject);
|
||||||
$scope.$watch('representation.selected.key', updateQueryParam);
|
$scope.$watch('representation.selected.key', updateQueryParam);
|
||||||
|
@ -31,6 +31,7 @@ define(
|
|||||||
var mockScope,
|
var mockScope,
|
||||||
mockLocation,
|
mockLocation,
|
||||||
mockRoute,
|
mockRoute,
|
||||||
|
mockWindow,
|
||||||
mockUnlisten,
|
mockUnlisten,
|
||||||
controller;
|
controller;
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ define(
|
|||||||
);
|
);
|
||||||
mockScope.ngModel = {};
|
mockScope.ngModel = {};
|
||||||
mockRoute = { current: { params: {} } };
|
mockRoute = { current: { params: {} } };
|
||||||
|
mockWindow = {};
|
||||||
mockLocation = jasmine.createSpyObj(
|
mockLocation = jasmine.createSpyObj(
|
||||||
"$location",
|
"$location",
|
||||||
[ "path", "search" ]
|
[ "path", "search" ]
|
||||||
@ -61,7 +63,8 @@ define(
|
|||||||
controller = new BrowseObjectController(
|
controller = new BrowseObjectController(
|
||||||
mockScope,
|
mockScope,
|
||||||
mockLocation,
|
mockLocation,
|
||||||
mockRoute
|
mockRoute,
|
||||||
|
mockWindow
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user