diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js index aa55d51df85ea0beb3ca7edfef8361218a6922ef..57e014af237820c7c01d7b5dee020110ef684f5e 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js @@ -162,27 +162,32 @@ function MainController(profile) { case "showInspectors": document.title = "Show Inspectors"; this._showInspectors(); + window.scrollTo(0,0); break; case "showHelloPage": document.title = "Main Menu"; this._showHelloPage(); + window.scrollTo(0,0); break; case "showSearchPage": document.title = "Search"; this._showSearchPage(arg); + window.scrollTo(0,0); break; case "showProjectPageFromPermId": var _this = this; this.serverFacade.getProjectFromPermId(arg, function(project) { document.title = "Project " + project.code; - _this._showProjectPageFromPermId(project); + _this._showProjectPage(project); + window.scrollTo(0,0); }); break; case "showExperimentPageFromIdentifier": var _this = this; this.serverFacade.listExperimentsForIdentifiers([arg], function(data) { document.title = "Experiment " + arg; - _this._showExperimentPageFromIdentifier(data.result[0]); + _this._showExperimentPage(data.result[0]); + window.scrollTo(0,0); }); break; case "showCreateSubExperimentPage": @@ -192,18 +197,22 @@ function MainController(profile) { var experimentIdentifier = argsMap["experimentIdentifier"]; document.title = "Create Sample " + arg; this._showCreateSubExperimentPage(sampleTypeCode, experimentIdentifier); + window.scrollTo(0,0); break; case "showSamplesPage": document.title = arg + " List"; this._showSamplesPage(arg); + window.scrollTo(0,0); break; case "showSampleHierarchyPage": document.title = "Hierarchy " + arg; this._showSampleHierarchyPage(arg); + window.scrollTo(0,0); break; case "showCreateSamplePage": document.title = "Create Sample " + arg; this._showCreateSamplePage(arg); + window.scrollTo(0,0); break; case "showEditSamplePageFromPermId": var _this = this; @@ -213,6 +222,7 @@ function MainController(profile) { } else { document.title = data[0].code; _this._showEditSamplePage(data[0]); + window.scrollTo(0,0); } }); break; @@ -224,6 +234,7 @@ function MainController(profile) { } else { document.title = data[0].code; _this._showViewSamplePage(data[0]); + window.scrollTo(0,0); } }); break; @@ -235,6 +246,7 @@ function MainController(profile) { } else { document.title = "Create Data Set for " + data[0].code; _this._showCreateDataSetPage(data[0]); + window.scrollTo(0,0); } }); break; @@ -330,14 +342,14 @@ function MainController(profile) { }); } - this._showProjectPageFromPermId = function(project) { + this._showProjectPage = function(project) { //Show Form var projectForm = new ProjectForm("mainContainer", this, project); projectForm.init(); this.currentView = projectForm; } - this._showExperimentPageFromIdentifier = function(experiment) { + this._showExperimentPage = function(experiment) { //Show Form var experimentForm = new ExperimentForm("mainContainer", this, experiment, ExperimentFormMode.VIEW); experimentForm.init(); diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js index 01dda05778c130c0f7fe1ccfd0c4103ec1fd408c..3b6e8c52b283d77d2360614c820eaa4fbc0738ed 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js @@ -29,7 +29,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { this._serverFacade = serverFacade; this._menuDOMTitle = null; this._menuDOMBody = null; - this._menuStructure = new SideMenuWidgetComponent(false, true, "Main Menu", null, { children : [] }, 'showHelloPage', null); + this._menuStructure = new SideMenuWidgetComponent(false, true, "Main Menu", null, { children : [] }, 'showHelloPage', null, ""); this._pointerToMenuNode = this._menuStructure; this._getProjectNodeForCode = function(projectCode) { @@ -65,7 +65,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { var _this = this; this._menuStructure.newMenuIfSelected.children.push( - new SideMenuWidgetComponent(false, true, "Lab Notebook", this._menuStructure, null, null, null) + new SideMenuWidgetComponent(false, true, "Lab Notebook", this._menuStructure, null, null, null, "") ); this._serverFacade.listSpacesWithProjectsAndRoleAssignments(null, function(dataWithSpacesAndProjects) { @@ -77,7 +77,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { var newMenuIfSelectedSpace = { children : [] } - var menuItemSpace = new SideMenuWidgetComponent(true, false, space.code, _this._menuStructure, newMenuIfSelectedSpace, null, null); + var menuItemSpace = new SideMenuWidgetComponent(true, false, space.code, _this._menuStructure, newMenuIfSelectedSpace, null, null, "(Space)"); _this._menuStructure.newMenuIfSelected.children.push(menuItemSpace); //Fill Projects @@ -90,7 +90,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { var newMenuIfSelectedProject = { children : [] } - var menuItemProject = new SideMenuWidgetComponent(true, false, project.code, menuItemSpace, newMenuIfSelectedProject, "showProjectPageFromPermId", project.permId); + var menuItemProject = new SideMenuWidgetComponent(true, false, project.code, menuItemSpace, newMenuIfSelectedProject, "showProjectPageFromPermId", project.permId, "(Project)"); newMenuIfSelectedSpace.children.push(menuItemProject); } } @@ -108,7 +108,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { children : [] } - var menuItemExperiment = new SideMenuWidgetComponent(true, false, experiment.code, projectNode, newMenuIfSelectedExperiment, "showExperimentPageFromIdentifier", experiment.identifier); + var menuItemExperiment = new SideMenuWidgetComponent(true, false, experiment.code, projectNode, newMenuIfSelectedExperiment, "showExperimentPageFromIdentifier", experiment.identifier, "(Experiment)"); projectNode.newMenuIfSelected.children.push(menuItemExperiment); } @@ -122,14 +122,14 @@ function SideMenuWidget(mainController, containerId, serverFacade) { var experimentCode = subExperiment.experimentIdentifierOrNull.split("/")[3]; var experimentNode = _this._getExperimentNodeForCode(projectCode, experimentCode); - var menuItemSubExperiment = new SideMenuWidgetComponent(true, false, subExperiment.code, experimentNode, null, "showViewSamplePageFromPermId", subExperiment.permId); + var menuItemSubExperiment = new SideMenuWidgetComponent(true, false, subExperiment.code, experimentNode, null, "showViewSamplePageFromPermId", subExperiment.permId, "(Sub Exp.)"); experimentNode.newMenuIfSelected.children.push(menuItemSubExperiment); } } //Fill Inventory _this._menuStructure.newMenuIfSelected.children.push( - new SideMenuWidgetComponent(false, true, "Inventory", _this._menuStructure, null, null, null) + new SideMenuWidgetComponent(false, true, "Inventory", _this._menuStructure, null, null, null, "") ); var profile = _this._mainController.profile; @@ -148,13 +148,13 @@ function SideMenuWidget(mainController, containerId, serverFacade) { description = sampleType.code; } - var menuItemSampleType = new SideMenuWidgetComponent(true, false, description, _this._menuStructure, null, "showSamplesPage", sampleType.code) + var menuItemSampleType = new SideMenuWidgetComponent(true, false, description, _this._menuStructure, null, "showSamplesPage", sampleType.code, "(Inventory)"); newMenuIfSelectedTypeGroup.children.push(menuItemSampleType); } } _this._menuStructure.newMenuIfSelected.children.push( - new SideMenuWidgetComponent(true, false, typeGroups[typeGroupCode]["DISPLAY_NAME"], _this._menuStructure, newMenuIfSelectedTypeGroup, null, null) + new SideMenuWidgetComponent(true, false, typeGroups[typeGroupCode]["DISPLAY_NAME"], _this._menuStructure, newMenuIfSelectedTypeGroup, null, null, "(Inventory)") ); } @@ -298,7 +298,8 @@ function SideMenuWidget(mainController, containerId, serverFacade) { this._menuDOMTitle.append(backButton); } - var $mainTitle = $("<span>").append(menuToPaint.displayName); + var $mainTitle = $("<span>").append(menuToPaint.displayName + " " + menuToPaint.contextTitle); + if(isBackButtonShown) { $mainTitle.css({ "margin-left" : "-24px" @@ -354,10 +355,11 @@ function SideMenuWidget(mainController, containerId, serverFacade) { } -function SideMenuWidgetComponent(isSelectable, isTitle, displayName, parent, newMenuIfSelected, newViewIfSelected, newViewIfSelectedData) { +function SideMenuWidgetComponent(isSelectable, isTitle, displayName, parent, newMenuIfSelected, newViewIfSelected, newViewIfSelectedData, contextTitle) { this.isSelectable = isSelectable; this.isTitle = isTitle; this.displayName = displayName; + this.contextTitle = contextTitle; this.parent = parent; this.newMenuIfSelected = newMenuIfSelected; this.newViewIfSelected = newViewIfSelected;