From 85bf9f937fa2ec46e42f791fc6815f7c2f5446ea Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 22 Mar 2012 10:42:05 -0700 Subject: file picker - added size unit new file - don't disable OK is file exists Signed-off-by: Ananya Sen --- js/components/ui/icon-list-basic/icon.reel/icon.js | 2 +- .../ui/tree-basic/treeItem.reel/treeItem.js | 2 +- .../picker-navigator.reel/picker-navigator.js | 2 +- .../new-file-options-navigator.js | 26 +++++++++++++++------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.js b/js/components/ui/icon-list-basic/icon.reel/icon.js index 1ef6e277..7d36bc59 100755 --- a/js/components/ui/icon-list-basic/icon.reel/icon.js +++ b/js/components/ui/icon-list-basic/icon.reel/icon.js @@ -86,7 +86,7 @@ var Icon = exports.Icon = Montage.create(Component, { this.metadata = "Name: "+this.icondata.name; } this.metadata = this.metadata + "
" + "Type: "+this.icondata.type; - if(this.icondata.size){this.metadata = this.metadata + "
" + "Size: "+this.icondata.size;} + if(this.icondata.size){this.metadata = this.metadata + "
" + "Size: "+this.icondata.size+ " bytes";} if(this.icondata.creationDate){this.metadata = this.metadata + "
" + "Creation date: "+ this.formatTimestamp(this.icondata.creationDate);} if(this.icondata.modifiedDate){this.metadata = this.metadata + "
" + "Modified date: "+ this.formatTimestamp(this.icondata.modifiedDate);} diff --git a/js/components/ui/tree-basic/treeItem.reel/treeItem.js b/js/components/ui/tree-basic/treeItem.reel/treeItem.js index 13e278e9..e9e5c1fb 100755 --- a/js/components/ui/tree-basic/treeItem.reel/treeItem.js +++ b/js/components/ui/tree-basic/treeItem.reel/treeItem.js @@ -118,7 +118,7 @@ exports.TreeItem = Montage.create(Component, { this.metadata = "Name: "+this.treeItemData.name; } this.metadata = this.metadata + "
" + "Type: "+this.treeItemData.type; - if(this.treeItemData.size){this.metadata = this.metadata + "
" + "Size: "+this.treeItemData.size;} + if(this.treeItemData.size){this.metadata = this.metadata + "
" + "Size: "+this.treeItemData.size+ " bytes";} if(this.treeItemData.creationDate){this.metadata = this.metadata + "
" + "Creation date: "+ this.formatTimestamp(this.treeItemData.creationDate);} if(this.treeItemData.modifiedDate){this.metadata = this.metadata + "
" + "Modified date: "+ this.formatTimestamp(this.treeItemData.modifiedDate);} 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 e31fa29d..3cf6fc5a 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 @@ -500,7 +500,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { metadata = "Name: "+data.name; } metadata = metadata + "
" + "Type: "+data.type; - if(data.size){metadata = metadata + "
" + "Size: "+data.size;} + if(data.size){metadata = metadata + "
" + "Size: "+data.size+" bytes";} if(data.creationDate){metadata = metadata + "
" + "Creation date: "+ this.formatTimestamp(data.creationDate);} if(data.modifiedDate){metadata = metadata + "
" + "Modified date: "+ this.formatTimestamp(data.modifiedDate);} } diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index 5adcc250..f63067b1 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js @@ -297,10 +297,16 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C }else{ if(this.error.innerHTML === ""){ this.showError("! Project Template, Name and Directory should be valid."); - } - //disable ok - if(!this.okButton.hasAttribute("disabled")){ - this.okButton.setAttribute("disabled", "true"); + //disable ok + if(!this.okButton.hasAttribute("disabled")){ + this.okButton.setAttribute("disabled", "true"); + } + }else if(!this.selectedProjectType || !this.selectedTemplate){ + this.showError("! Project Template should be selected."); + //disable ok + if(!this.okButton.hasAttribute("disabled")){ + this.okButton.setAttribute("disabled", "true"); + } } } } @@ -399,6 +405,10 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C if(uri !== ""){ if(!status){ this.showError("! Invalid directory."); + //disable ok + if(!this.okButton.hasAttribute("disabled")){ + this.okButton.setAttribute("disabled", "true"); + } } } return status; @@ -410,6 +420,10 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C if(fileName !== ""){ if(!status){ this.showError("! Invalid file name."); + //disable ok + if(!this.okButton.hasAttribute("disabled")){ + this.okButton.setAttribute("disabled", "true"); + } } } return status; @@ -445,10 +459,6 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C value:function(errorString){ this.error.innerHTML = ""; this.error.innerHTML=errorString; - //disable ok - if(!this.okButton.hasAttribute("disabled")){ - this.okButton.setAttribute("disabled", "true"); - } } }, -- cgit v1.2.3