Frontend] More refining of collapsing treeview

open #90
Treeview and Inspector should be hidden by default
when opening in a new tab;
This commit is contained in:
Charles Hacskaylo
2015-10-26 12:19:37 -07:00
parent 7d42292184
commit f655346f46
2 changed files with 11 additions and 9 deletions

View File

@ -29,7 +29,7 @@
"key": "PaneController", "key": "PaneController",
"implementation": "PaneController.js", "implementation": "PaneController.js",
"priority": "preferred", "priority": "preferred",
"depends": [ "$scope", "agentService" ] "depends": [ "$scope", "agentService","$window" ]
}, },
{ {
"key": "BrowseObjectController", "key": "BrowseObjectController",

View File

@ -33,10 +33,12 @@ define(
* @constructor * @constructor
* @memberof platform/commonUI/browse * @memberof platform/commonUI/browse
*/ */
function BrowseTreeController($scope, agentService) { function PaneController($scope, agentService, $window) {
var self = this; var self = this;
this.agentService = agentService; this.agentService = agentService;
this.state = true;
// Fast and cheap: if this has been opened in a new window, hide panes by default
this.state = !$window.opener;
/** /**
* Callback to invoke when any selection occurs in the tree. * Callback to invoke when any selection occurs in the tree.
@ -44,7 +46,7 @@ define(
* to the tree representation. * to the tree representation.
* *
* @property {Function} callback * @property {Function} callback
* @memberof platform/commonUI/browse.BrowseTreeController# * @memberof platform/commonUI/browse.PaneController#
*/ */
this.callback = function () { this.callback = function () {
// Note that, since this is a callback to pass, this is not // Note that, since this is a callback to pass, this is not
@ -59,20 +61,20 @@ define(
} }
/** /**
* Toggle the visibility of the tree. * Toggle the visibility of the pane.
*/ */
BrowseTreeController.prototype.toggle = function () { PaneController.prototype.toggle = function () {
this.state = !this.state; this.state = !this.state;
}; };
/** /**
* Get the desired visibility state of the tree. * Get the desired visibility state of the pane.
* @returns {boolean} true when visible * @returns {boolean} true when visible
*/ */
BrowseTreeController.prototype.visible = function () { PaneController.prototype.visible = function () {
return this.state; return this.state;
}; };
return BrowseTreeController; return PaneController;
} }
); );