aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/new-file-dialog
diff options
context:
space:
mode:
authorEric Guzman2012-04-05 18:42:40 -0700
committerEric Guzman2012-04-05 18:42:40 -0700
commit8ff9dde2053e41d85bb27d9c91808a30e551a138 (patch)
tree8eec67d632d82d3052ed470096eda13fd50a55c8 /js/io/ui/new-file-dialog
parent4631d54ffb4942378835689e9f5d70ed95610822 (diff)
parent7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff)
downloadninja-8ff9dde2053e41d85bb27d9c91808a30e551a138.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/io/ui/new-file-dialog')
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js19
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js18
2 files changed, 18 insertions, 19 deletions
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 02579676..3582f1a5 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
@@ -24,6 +24,7 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
24 24
25 this.newFileName.addEventListener("keyup", this, false); 25 this.newFileName.addEventListener("keyup", this, false);
26 this.newFileName.addEventListener("paste", this, false); 26 this.newFileName.addEventListener("paste", this, false);
27 this.newFileName.addEventListener("search", this, false);
27 this.newFileName.focus(); 28 this.newFileName.focus();
28 this.newFileName.select(); 29 this.newFileName.select();
29 } 30 }
@@ -39,14 +40,16 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, {
39 40
40 handleKeyup:{ 41 handleKeyup:{
41 value:function(evt){ 42 value:function(evt){
42 if(this.newFileName.value !== "") { 43 var newFileNameSetEvent = document.createEvent("Events");
43 var newFileNameSetEvent = document.createEvent("Events"); 44 newFileNameSetEvent.initEvent("newFileNameSet", false, false);
44 newFileNameSetEvent.initEvent("newFileNameSet", false, false); 45 newFileNameSetEvent.newFileName = this.newFileName.value;
45 newFileNameSetEvent.newFileName = this.newFileName.value; 46 newFileNameSetEvent.keyCode = evt.keyCode;
46 newFileNameSetEvent.keyCode = evt.keyCode; 47 this.eventManager.dispatchEvent(newFileNameSetEvent);
47 this.eventManager.dispatchEvent(newFileNameSetEvent); 48 }
48 } 49 },
50 handleSearch:{
51 value:function(evt){
52 this.handleKeyup(evt);
49 } 53 }
50 } 54 }
51
52}); \ No newline at end of file 55}); \ No newline at end of file
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