diff options
author | Ananya Sen | 2012-02-16 06:43:33 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-16 06:43:33 -0800 |
commit | 2e766c9eaa98fa20f311b3eb2f892a1a240e90cf (patch) | |
tree | f52bec8a102e8d74a196233b88e0df618ba4bcde /js/components/ui | |
parent | 4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87 (diff) | |
download | ninja-2e766c9eaa98fa20f311b3eb2f892a1a240e90cf.tar.gz |
file picker:
Enable ok if user double clicks folder and enter it.
Validate path if user enter it manually in addressbar.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components/ui')
-rw-r--r-- | js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js index edc24a2c..411386f9 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js | |||
@@ -203,6 +203,13 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
203 | this.pickerModel.storeHistory(this.pickerModel.currentRoot);//populate history | 203 | this.pickerModel.storeHistory(this.pickerModel.currentRoot);//populate history |
204 | 204 | ||
205 | this.updateMetadata(this.currentURI); | 205 | this.updateMetadata(this.currentURI); |
206 | |||
207 | //for directory selection, selected url is the folder entered | ||
208 | if(!this.pickerModel.inFileMode ){ | ||
209 | this.okButton.removeAttribute("disabled"); | ||
210 | //put into selectedItems..currently single selection is supported | ||
211 | this.selectedItems = [this.pickerModel.currentRoot]; | ||
212 | } | ||
206 | } | 213 | } |
207 | 214 | ||
208 | this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data | 215 | this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data |
@@ -211,6 +218,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
211 | this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon | 218 | this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon |
212 | //this.addressGo.addEventListener("click", this, false); | 219 | //this.addressGo.addEventListener("click", this, false); |
213 | this.addressBarUri.addEventListener("keydown", this, false); | 220 | this.addressBarUri.addEventListener("keydown", this, false); |
221 | this.addressBarUri.addEventListener("keyup", this, false); | ||
214 | this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly | 222 | this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly |
215 | this.backArrow.addEventListener("click", this, false); | 223 | this.backArrow.addEventListener("click", this, false); |
216 | this.forwardArrow.addEventListener("click", this, false); | 224 | this.forwardArrow.addEventListener("click", this, false); |
@@ -608,6 +616,13 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
608 | this.backArrow.classList.remove("disable"); | 616 | this.backArrow.classList.remove("disable"); |
609 | } | 617 | } |
610 | 618 | ||
619 | //for directory selection, selected url is the folder entered | ||
620 | if(!this.pickerModel.inFileMode ){ | ||
621 | this.okButton.removeAttribute("disabled"); | ||
622 | //put into selectedItems..currently single selection is supported | ||
623 | this.selectedItems = [evt.folderUri]; | ||
624 | } | ||
625 | |||
611 | } | 626 | } |
612 | }, | 627 | }, |
613 | 628 | ||
@@ -720,6 +735,21 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
720 | } | 735 | } |
721 | }, | 736 | }, |
722 | 737 | ||
738 | handleAddressBarUriKeyup:{ | ||
739 | value: function(evt){ | ||
740 | //disable ok if user enters an invalid uri | ||
741 | if(!this.application.ninja.coreIoApi.isValidUri(this.addressBarUri.value)){ | ||
742 | //disable OK | ||
743 | if(!this.okButton.hasAttribute("disabled")){ | ||
744 | this.okButton.setAttribute("disabled", "true"); | ||
745 | } | ||
746 | }else{ | ||
747 | this.okButton.removeAttribute("disabled"); | ||
748 | this.selectedItems = [this.addressBarUri.value]; | ||
749 | } | ||
750 | } | ||
751 | }, | ||
752 | |||
723 | handleRefreshButtonClick:{ | 753 | handleRefreshButtonClick:{ |
724 | value:function(evt){ | 754 | value:function(evt){ |
725 | var uri = this.addressBarUri.value; | 755 | var uri = this.addressBarUri.value; |