aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-05 11:46:46 -0700
committerValerio Virgillito2012-04-05 11:46:46 -0700
commitc00f59e9484580c07cd812f0578b920229228054 (patch)
tree83b42e708cd27a06a09d0dae66691507fd433740 /js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
parent91ffa45e4eb69b1434460f9b6c618745ac19a74e (diff)
parent5de25f936c9dce08f1d24824ae1946a07e7b708d (diff)
downloadninja-c00f59e9484580c07cd812f0578b920229228054.tar.gz
Merge pull request #158 from ananyasen/integration-candidate
- disable ok when text box is cleared using backspace and cross, for fil...
Diffstat (limited to 'js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js')
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js18
1 files changed, 7 insertions, 11 deletions
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 c98955ca..35c3b28e 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
@@ -30,12 +30,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
30 newFileName:{ 30 newFileName:{
31 writable:true, 31 writable:true,
32 enumerable:false, 32 enumerable:false,
33 value:"" 33 value:null
34 }, 34 },
35 newFileDirectory:{ 35 newFileDirectory:{
36 writable:true, 36 writable:true,
37 enumerable:false, 37 enumerable:false,
38 value:"" 38 value:null
39 }, 39 },
40 templateWidth:{ 40 templateWidth:{
41 writable:true, 41 writable:true,
@@ -331,7 +331,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
331 }else if(evt.keyCode === 27){ 331 }else if(evt.keyCode === 27){
332 this.handleCancelButtonAction(evt); 332 this.handleCancelButtonAction(evt);
333 } 333 }
334 else if(!!evt._event.newFileDirectory){ 334 else{
335 this.newFileDirectory = evt._event.newFileDirectory; 335 this.newFileDirectory = evt._event.newFileDirectory;
336 if(this.isValidUri(this.newFileDirectory)){ 336 if(this.isValidUri(this.newFileDirectory)){
337 this.enableOk(); 337 this.enableOk();
@@ -347,7 +347,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
347 }else if(evt.keyCode === 27){ 347 }else if(evt.keyCode === 27){
348 this.handleCancelButtonAction(evt); 348 this.handleCancelButtonAction(evt);
349 } 349 }
350 else if(!!evt._event.newFileName){ 350 else{
351 this.newFileName = evt._event.newFileName; 351 this.newFileName = evt._event.newFileName;
352 if(this.isValidFileName(this.newFileName)){ 352 if(this.isValidFileName(this.newFileName)){
353 this.enableOk(); 353 this.enableOk();
@@ -422,14 +422,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
422 isValidUri:{ 422 isValidUri:{
423 value: function(uri){ 423 value: function(uri){
424 var status= this.application.ninja.coreIoApi.isValidUri(uri); 424 var status= this.application.ninja.coreIoApi.isValidUri(uri);
425 if(uri !== ""){ 425 if((uri !== null) && !status){
426 if(!status){
427 this.showError("! Invalid directory."); 426 this.showError("! Invalid directory.");
428 //disable ok 427 //disable ok
429 if(!this.okButton.hasAttribute("disabled")){ 428 if(!this.okButton.hasAttribute("disabled")){
430 this.okButton.setAttribute("disabled", "true"); 429 this.okButton.setAttribute("disabled", "true");
431 } 430 }
432 }
433 } 431 }
434 return status; 432 return status;
435 } 433 }
@@ -437,14 +435,12 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
437 isValidFileName:{ 435 isValidFileName:{
438 value: function(fileName){ 436 value: function(fileName){
439 var status = this.validateFileName(fileName); 437 var status = this.validateFileName(fileName);
440 if(fileName !== ""){ 438 if((fileName !== null ) && !status){
441 if(!status){
442 this.showError("! Invalid file name."); 439 this.showError("! Invalid file name.");
443 //disable ok 440 //disable ok
444 if(!this.okButton.hasAttribute("disabled")){ 441 if(!this.okButton.hasAttribute("disabled")){
445 this.okButton.setAttribute("disabled", "true"); 442 this.okButton.setAttribute("disabled", "true");
446 } 443 }
447 }
448 } 444 }
449 return status; 445 return status;
450 } 446 }
@@ -488,7 +484,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
488 validateFileName:{ 484 validateFileName:{
489 value: function(fileName){ 485 value: function(fileName){
490 var status = false; 486 var status = false;
491 if(fileName !== ""){ 487 if((fileName !== null) && (fileName !== "")){
492 fileName = fileName.replace(/^\s+|\s+$/g,""); 488 fileName = fileName.replace(/^\s+|\s+$/g,"");
493 status = !(/[/\\]/g.test(fileName)); 489 status = !(/[/\\]/g.test(fileName));
494 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden 490 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden