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-dialog/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 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'js/io/ui/new-file-dialog') 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; -- cgit v1.2.3