From 1bea5da094906d6f53cfb2604a43f1b6a93995aa Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Thu, 10 Mar 2016 15:15:47 +0000
Subject: [PATCH] SSDM-3287 : Tree navigation - working prototype

SVN: 35873
---
 .../DataSetForm/widgets/DatasetViewerModel.js    |  2 +-
 .../DataSetForm/widgets/DatasetViewerView.js     | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
index 9e77dffa389..2a7cbacfbdd 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerModel.js
@@ -34,7 +34,7 @@ function DataSetViewerModel(containerId, profile, sample, serverFacade, datastor
 	this.enableOpenDataset = enableOpenDataset;
 	this.sampleDataSets = {};
 	this.datastoreDownloadURL = datastoreDownloadURL
-	this.lastUsedPath = [];
+	this.lastUsedPathList = [];
 	
 	this.dataSetViewerMode = DataSetViewerMode.LIST;
 	
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js
index e9b4d213ae9..30c694c9db2 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js
@@ -222,7 +222,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
     			dfd.resolve(results);
 			};
 			
-			_this.updateDirectoryView(datasetCode, pathToLoad, false, repaintEvent);
+			_this.updateDirectoryView(datasetCode, pathToLoad, true, repaintEvent);
     	};
     	
     	$tree.fancytree({
@@ -236,11 +236,11 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
         
 	}
 	
-	this.updateDirectoryView = function(code, path, isBack, repaintEvent) {
+	this.updateDirectoryView = function(code, path, notAddPath, repaintEvent) {
 		var _this = this;
 		mainController.serverFacade.listFilesForDataSet(code, path, false, function(files) {
-			if(!isBack) {
-				_this._dataSetViewerModel.lastUsedPath.push(path);
+			if(!notAddPath) {
+				_this._dataSetViewerModel.lastUsedPathList.push(path);
 			}
 			
 			if(!repaintEvent) {
@@ -264,7 +264,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
 		var _this = this;
 		
 		// Path
-		var parentPath = this._dataSetViewerModel.lastUsedPath[this._dataSetViewerModel.lastUsedPath.length - 1];
+		var parentPath = this._dataSetViewerModel.lastUsedPathList[this._dataSetViewerModel.lastUsedPathList.length - 1];
 		$container.append($("<legend>").append("Path: " + parentPath));
 		
 		//
@@ -294,16 +294,16 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
 		});
 		
 		var backClick = function(event) {
-			if(_this._dataSetViewerModel.lastUsedPath.length === 1) {
+			if(_this._dataSetViewerModel.lastUsedPathList.length === 1) {
 				_this.repaintDatasets();
 			} else {
 				var repaintEvent = function(code, files) {
 					_this.repaintFiles(code, files.result);
 				};
 				
-				_this.updateDirectoryView(datasetCode, _this._dataSetViewerModel.lastUsedPath[_this._dataSetViewerModel.lastUsedPath.length - 2], true, repaintEvent);
+				_this.updateDirectoryView(datasetCode, _this._dataSetViewerModel.lastUsedPathList[_this._dataSetViewerModel.lastUsedPathList.length - 2], true, repaintEvent);
 			}
-			_this._dataSetViewerModel.lastUsedPath.pop();
+			_this._dataSetViewerModel.lastUsedPathList.pop();
 			event.stopPropagation();
 		};
 		
-- 
GitLab