From c9d0cb73698066247c6267bba8fa446a979565fb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 9 Feb 2012 11:12:21 -0800 Subject: fixed templates descriptor, changed validation to on key up, fixed minor ui issues Signed-off-by: Ananya Sen --- .../new-file-location.reel/new-file-location.js | 4 ++-- .../new-file-options-navigator.js | 9 +++++---- js/io/ui/new-file-dialog/new-file-workflow-controller.js | 2 +- js/io/ui/save-as-dialog.reel/save-as-dialog.js | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'js/io/ui') diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 7da13dfc..fae8f9c7 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js @@ -37,12 +37,12 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { this.fileInputField.selectDirectory = true; - this.newFileName.addEventListener("blur", function(evt){that.handleNewFileNameOnblur(evt);}, false); + this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false); } }, - handleNewFileNameOnblur:{ + handleNewFileNameOnkeyup:{ value:function(evt){ if(this.newFileName.value !== ""){ var newFileNameSetEvent = document.createEvent("Events"); 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 2f148621..bcb9d123 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 @@ -217,8 +217,9 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C if(/[^/\\]$/g.test(projectDirectory)){ projectDirectory = projectDirectory + "/"; } - if(!!fileExtension && (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length))){ - projectName = projectName+fileExtension; + + if(!!fileExtension && ((projectName.lastIndexOf(fileExtension) === -1) || (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length)))){ + projectName = projectName+fileExtension;//append file extension if file extension is already not present or is actually part of the file name } newFilePath = "" + projectDirectory + projectName; @@ -367,7 +368,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C }, isValidFileName:{ value: function(fileName){ - var status = this.isValidFileName(fileName); + var status = this.validateFileName(fileName); if(fileName !== ""){ if(!status){ this.showError("! Invalid file name."); @@ -399,7 +400,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C /*** * file name validation */ - isValidFileName:{ + validateFileName:{ value: function(fileName){ var status = false; if(fileName !== ""){ diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js index 16075ecf..6cf2a2ae 100755 --- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js +++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js @@ -44,7 +44,7 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre this.model.projectTypeData = this.loadDescriptor("js/io/templates/descriptor.json"); //get default project type - this.model.defaultProjectType = "files/html.txt"; + this.model.defaultProjectType = "/js/io/templates/files/html.txt"; this.model.callback = data.callback || null; this.model.callbackScope = data.callbackScope || null; diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index d1f1c26b..4546e124 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js @@ -54,7 +54,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { this.newFileName.value = this.fileName; this.fileInputField.newFileDirectory.value = this.folderUri; - this.newFileName.addEventListener("blur", function(evt){self.handleNewFileNameOnblur(evt);}, false); + this.newFileName.addEventListener("keyup", function(evt){self.handleNewFileNameOnkeyup(evt);}, false); this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); @@ -68,18 +68,18 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { value:function(evt){ if(!!evt._event.newFileDirectory){ this.folderUri = evt._event.newFileDirectory; - if(this.folderUri !== ""){ + if(this.isValidUri(this.folderUri)){ this.enableOk(); } } } }, - handleNewFileNameOnblur:{ + handleNewFileNameOnkeyup:{ value:function(evt){ this.fileName = this.newFileName.value; if(this.fileName !== ""){ - if(this.fileName !== ""){ + if(this.isValidFileName(this.fileName)){ this.enableOk(); } } @@ -165,7 +165,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { }, isValidFileName:{ value: function(fileName){ - var status = this.isValidFileName(fileName); + var status = this.validateFileName(fileName); if(fileName !== ""){ if(!status){ this.showError("! Invalid file name."); @@ -198,7 +198,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { /*** * file name validation */ - isValidFileName:{ + validateFileName:{ value: function(fileName){ var status = false; if(fileName !== ""){ -- cgit v1.2.3