From fbde30a4651d34ac569bf6750db5dd017ccc8d6e Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:18:56 -0800 Subject: fixed picker address dropdown to backtrace till the logical drive Signed-off-by: Ananya Sen --- js/io/ui/file-picker/file-picker-controller.js | 2 +- js/io/ui/file-picker/file-picker-model.js | 6 ++++++ js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'js/io/ui') diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 3b19de83..105dc223 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js @@ -104,7 +104,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require aModel.topLevelDirectories = topLevelDirectories; if(!!topLevelDirectories && !!topLevelDirectories[0]){ - aModel.currentRoot = topLevelDirectories[0].uri; + aModel.currentRoot = aModel.currentLogicalDrive = topLevelDirectories[0].uri; } //populate the last opened folder first, if none then populate default root diff --git a/js/io/ui/file-picker/file-picker-model.js b/js/io/ui/file-picker/file-picker-model.js index 09c3ae9c..c92ec586 100755 --- a/js/io/ui/file-picker/file-picker-model.js +++ b/js/io/ui/file-picker/file-picker-model.js @@ -73,6 +73,12 @@ exports.FilePickerModel = (require("montage/core/core").Montage).create(require( value:"" }, + currentLogicalDrive:{ + writable:true, + enumerable:true, + value:"" + }, + callback:{ writable:true, enumerable:true, diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 3d99ae4d..1e3cb1b9 100644 --- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js @@ -346,6 +346,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { var arr = []; var temp = new String(uri); while(temp.indexOf("/") != -1){ + + if(temp === this.pickerModel.currentLogicalDrive){//stop at the logical drive + break; + } + temp = temp.substring(0, temp.lastIndexOf("/")); //populate dropdown irrespective of validity @@ -560,7 +565,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { enumerable: true, writable: false, value : function(evt, dirObj){ - this.currentURI = dirObj.uri; + this.currentURI = this.pickerModel.currentLogicalDrive = dirObj.uri; var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view -- cgit v1.2.3