+ ng-class="modelPaneInspect.visible() ? 'pane-inspect-showing' : 'pane-inspect-hidden'"
+ hide-parameter="hideInspector">
diff --git a/platform/commonUI/browse/src/InspectorPaneController.js b/platform/commonUI/browse/src/InspectorPaneController.js
index dbefbc4d72..2ba97cda9c 100644
--- a/platform/commonUI/browse/src/InspectorPaneController.js
+++ b/platform/commonUI/browse/src/InspectorPaneController.js
@@ -35,9 +35,8 @@ define(
* @param navigationService
* @constructor
*/
- function InspectorPaneController($scope, agentService, $window, navigationService) {
- PaneController.call(this, $scope, agentService, $window);
-
+ function InspectorPaneController($scope, agentService, $window, navigationService, $location, $attrs) {
+ PaneController.call(this, $scope, agentService, $window, $location, $attrs);
var statusListener,
self = this;
diff --git a/platform/commonUI/browse/src/PaneController.js b/platform/commonUI/browse/src/PaneController.js
index 46f47e1f6f..4f4e587764 100644
--- a/platform/commonUI/browse/src/PaneController.js
+++ b/platform/commonUI/browse/src/PaneController.js
@@ -31,12 +31,17 @@ define(
* @constructor
* @memberof platform/commonUI/browse
*/
- function PaneController($scope, agentService, $window) {
+ function PaneController($scope, agentService, $window, $location, $attrs) {
var self = this;
this.agentService = agentService;
+ var hideParameterPresent = $location.search().hasOwnProperty($attrs.hideParameter);
- // Fast and cheap: if this has been opened in a new window, hide panes by default
- this.state = !$window.opener;
+ if ($attrs.hideParameter && hideParameterPresent) {
+ this.state = false;
+ $location.search($attrs.hideParameter, undefined);
+ } else {
+ this.state = true;
+ }
/**
* Callback to invoke when any selection occurs in the tree.
@@ -70,7 +75,7 @@ define(
* @returns {boolean} true when visible
*/
PaneController.prototype.visible = function () {
- return this.state;
+ return !!this.state;
};
return PaneController;
diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js
index c132d73709..80e2ec689e 100644
--- a/platform/commonUI/browse/src/windowing/NewTabAction.js
+++ b/platform/commonUI/browse/src/windowing/NewTabAction.js
@@ -38,6 +38,7 @@ define(
this.urlService = urlService;
this.open = function () {
+ arguments[0] += "&hideTree=true&hideInspector=true";
$window.open.apply($window, arguments);
};
diff --git a/platform/commonUI/browse/test/InspectorPaneControllerSpec.js b/platform/commonUI/browse/test/InspectorPaneControllerSpec.js
index 635396902b..016e88ecf5 100644
--- a/platform/commonUI/browse/test/InspectorPaneControllerSpec.js
+++ b/platform/commonUI/browse/test/InspectorPaneControllerSpec.js
@@ -33,7 +33,9 @@ define(
mockNavigationService,
mockNavigationUnlistener,
mockStatusUnlistener,
- controller;
+ controller,
+ mockLocation,
+ mockAttrs;
beforeEach(function () {
mockScope = jasmine.createSpyObj("$scope", ["$on"]);
@@ -71,7 +73,12 @@ define(
mockDomainObject.hasCapability.andReturn(true);
mockDomainObject.getCapability.andReturn(mockStatusCapability);
- controller = new InspectorPaneController(mockScope, mockAgentService, mockWindow, mockNavigationService);
+ mockLocation = jasmine.createSpyObj('location', ['search']);
+ mockLocation.search.andReturn({});
+
+ mockAttrs = {};
+
+ controller = new InspectorPaneController(mockScope, mockAgentService, mockWindow, mockNavigationService, mockLocation, mockAttrs);
});
it("listens for changes to navigation and attaches a status" +
diff --git a/platform/commonUI/browse/test/PaneControllerSpec.js b/platform/commonUI/browse/test/PaneControllerSpec.js
index 1748db6a31..f98c7c4c7a 100644
--- a/platform/commonUI/browse/test/PaneControllerSpec.js
+++ b/platform/commonUI/browse/test/PaneControllerSpec.js
@@ -29,7 +29,9 @@ define(
mockAgentService,
mockDomainObjects,
mockWindow,
- controller;
+ controller,
+ mockLocation,
+ mockAttrs;
// We want to reinstantiate for each test case
// because device state can influence constructor-time behavior
@@ -37,7 +39,9 @@ define(
return new PaneController(
mockScope,
mockAgentService,
- mockWindow
+ mockWindow,
+ mockLocation,
+ mockAttrs
);
}
@@ -59,6 +63,11 @@ define(
["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"]
);
mockWindow = jasmine.createSpyObj("$window", ["open"]);
+
+ mockLocation = jasmine.createSpyObj('location', ['search']);
+ mockLocation.search.andReturn({});
+
+ mockAttrs = {};
});
it("is initially visible", function () {
@@ -86,6 +95,24 @@ define(
// Tree should have collapsed
expect(controller.visible()).toBeFalsy();
});
+
+ describe("specifying hideParameter", function () {
+ beforeEach(function () {
+ mockAttrs = {hideParameter: 'hideTree'};
+ });
+
+ it("sets pane state to false when in location.search", function () {
+ mockLocation.search.andReturn({'hideTree': true});
+ expect(instantiateController().visible()).toBe(false);
+ expect(mockLocation.search).toHaveBeenCalledWith('hideTree', undefined);
+ });
+
+ it("sets state to true when not found in location.search", function () {
+ mockLocation.search.andReturn({});
+ expect(instantiateController().visible()).toBe(true);
+ expect(mockLocation.search).not.toHaveBeenCalledWith('hideTree', undefined);
+ });
+ });
});
}
);