aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-09 11:12:21 -0800
committerAnanya Sen2012-02-09 11:12:21 -0800
commitc9d0cb73698066247c6267bba8fa446a979565fb (patch)
tree8d706201eb23565e41e288c710e9ff8a83639113
parent04d375a02e44d1c11054ace16cd243ada8e6bd23 (diff)
downloadninja-c9d0cb73698066247c6267bba8fa446a979565fb.tar.gz
fixed templates descriptor, changed validation to on key up, fixed minor ui issues
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xjs/components/ui/FilePicker/file-input-field.reel/file-input-field.js4
-rwxr-xr-xjs/io/system/fileio.js2
-rw-r--r--js/io/templates/descriptor.json18
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js4
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js9
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js2
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js12
-rw-r--r--js/mediators/io-mediator.js11
8 files changed, 32 insertions, 30 deletions
diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
index f832e618..8710de63 100755
--- a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
+++ b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js
@@ -30,7 +30,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
30 30
31 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); 31 this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false);
32 32
33 this.newFileDirectory.addEventListener("blur", function(evt){that.handleNewFileDirectoryOnblur(evt);}, false); 33 this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false);
34 } 34 }
35 }, 35 },
36 36
@@ -77,7 +77,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, {
77 } 77 }
78 }, 78 },
79 79
80 handleNewFileDirectoryOnblur:{ 80 handleNewFileDirectoryOnkeyup:{
81 value:function(evt){ 81 value:function(evt){
82 if(this.newFileDirectory.value !== ""){ 82 if(this.newFileDirectory.value !== ""){
83 var newFileDirectorySetEvent = document.createEvent("Events"); 83 var newFileDirectorySetEvent = document.createEvent("Events");
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 2c49e849..23186cf2 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -20,7 +20,7 @@ NOTES:
20var Montage = require("montage/core/core").Montage; 20var Montage = require("montage/core/core").Montage;
21//////////////////////////////////////////////////////////////////////// 21////////////////////////////////////////////////////////////////////////
22//Exporting as File I/O 22//Exporting as File I/O
23exports.FileIo = Montage.create(Object.prototype, { 23exports.FileIo = Montage.create(require("montage/ui/component").Component, {
24 //////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////
25 //newFile Object (*required): {uri*, contents, contentType} 25 //newFile Object (*required): {uri*, contents, contentType}
26 //Return codes 26 //Return codes
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
index f28455fa..20870934 100644
--- a/js/io/templates/descriptor.json
+++ b/js/io/templates/descriptor.json
@@ -6,58 +6,58 @@
6 "name":"Blank File", 6 "name":"Blank File",
7 "uri":"/", 7 "uri":"/",
8 "type":"directory", 8 "type":"directory",
9 "children":["files/html.txt", "files/js.txt", "files/css.txt", "files/json.txt", "files/php.txt", "files/pl.txt", "files/py.txt", "files/rb.txt"] 9 "children":["/js/io/templates/files/html.txt", "/js/io/templates/files/files/js.txt", "/js/io/templates/files/css.txt", "/js/io/templates/files/json.txt", "/js/io/templates/files/php.txt", "/js/io/templates/files/pl.txt", "/js/io/templates/files/py.txt", "/js/io/templates/files/rb.txt"]
10 }, 10 },
11 "files/html.txt":{ 11 "/js/io/templates/files/html.txt":{
12 "name":"HTML", 12 "name":"HTML",
13 "uri":"/js/io/templates/files/html.txt", 13 "uri":"/js/io/templates/files/html.txt",
14 "type":"file", 14 "type":"file",
15 "fileExtension":".html", 15 "fileExtension":".html",
16 "children":["defaultTemplate"] 16 "children":["defaultTemplate"]
17 }, 17 },
18 "files/js.txt":{ 18 "/js/io/templates/files/files/js.txt":{
19 "name":"JavaScript", 19 "name":"JavaScript",
20 "uri":"/js/io/templates/files/files/js.txt", 20 "uri":"/js/io/templates/files/files/js.txt",
21 "type":"file", 21 "type":"file",
22 "fileExtension":".js", 22 "fileExtension":".js",
23 "children":["defaultTemplate"] 23 "children":["defaultTemplate"]
24 }, 24 },
25 "files/css.txt":{ 25 "/js/io/templates/files/css.txt":{
26 "name":"Cascading Style Sheets", 26 "name":"Cascading Style Sheets",
27 "uri":"/js/io/templates/files/css.txt", 27 "uri":"/js/io/templates/files/css.txt",
28 "type":"file", 28 "type":"file",
29 "fileExtension":".css", 29 "fileExtension":".css",
30 "children":["defaultTemplate"] 30 "children":["defaultTemplate"]
31 }, 31 },
32 "files/json.txt":{ 32 "/js/io/templates/files/json.txt":{
33 "name":"JSON", 33 "name":"JSON",
34 "uri":"/js/io/templates/files/json.txt", 34 "uri":"/js/io/templates/files/json.txt",
35 "type":"file", 35 "type":"file",
36 "fileExtension":".json", 36 "fileExtension":".json",
37 "children":["defaultTemplate"] 37 "children":["defaultTemplate"]
38 }, 38 },
39 "files/php.txt":{ 39 "/js/io/templates/files/php.txt":{
40 "name":"PHP", 40 "name":"PHP",
41 "uri":"/js/io/templates/files/php.txt", 41 "uri":"/js/io/templates/files/php.txt",
42 "type":"file", 42 "type":"file",
43 "fileExtension":".php", 43 "fileExtension":".php",
44 "children":["defaultTemplate"] 44 "children":["defaultTemplate"]
45 }, 45 },
46 "files/pl.txt":{ 46 "/js/io/templates/files/pl.txt":{
47 "name":"Perl", 47 "name":"Perl",
48 "uri":"/js/io/templates/files/pl.txt", 48 "uri":"/js/io/templates/files/pl.txt",
49 "type":"file", 49 "type":"file",
50 "fileExtension":".pl", 50 "fileExtension":".pl",
51 "children":["defaultTemplate"] 51 "children":["defaultTemplate"]
52 }, 52 },
53 "files/py.txt":{ 53 "/js/io/templates/files/py.txt":{
54 "name":"Python", 54 "name":"Python",
55 "uri":"/js/io/templates/files/py.txt", 55 "uri":"/js/io/templates/files/py.txt",
56 "type":"file", 56 "type":"file",
57 "fileExtension":".py", 57 "fileExtension":".py",
58 "children":["defaultTemplate"] 58 "children":["defaultTemplate"]
59 }, 59 },
60 "files/rb.txt":{ 60 "/js/io/templates/files/rb.txt":{
61 "name":"Ruby", 61 "name":"Ruby",
62 "uri":"/js/io/templates/files/rb.txt", 62 "uri":"/js/io/templates/files/rb.txt",
63 "type":"file", 63 "type":"file",
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, {
37 37
38 this.fileInputField.selectDirectory = true; 38 this.fileInputField.selectDirectory = true;
39 39
40 this.newFileName.addEventListener("blur", function(evt){that.handleNewFileNameOnblur(evt);}, false); 40 this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false);
41 } 41 }
42 42
43 }, 43 },
44 44
45 handleNewFileNameOnblur:{ 45 handleNewFileNameOnkeyup:{
46 value:function(evt){ 46 value:function(evt){
47 if(this.newFileName.value !== ""){ 47 if(this.newFileName.value !== ""){
48 var newFileNameSetEvent = document.createEvent("Events"); 48 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
217 if(/[^/\\]$/g.test(projectDirectory)){ 217 if(/[^/\\]$/g.test(projectDirectory)){
218 projectDirectory = projectDirectory + "/"; 218 projectDirectory = projectDirectory + "/";
219 } 219 }
220 if(!!fileExtension && (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length))){ 220
221 projectName = projectName+fileExtension; 221 if(!!fileExtension && ((projectName.lastIndexOf(fileExtension) === -1) || (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length)))){
222 projectName = projectName+fileExtension;//append file extension if file extension is already not present or is actually part of the file name
222 } 223 }
223 newFilePath = "" + projectDirectory + projectName; 224 newFilePath = "" + projectDirectory + projectName;
224 225
@@ -367,7 +368,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
367 }, 368 },
368 isValidFileName:{ 369 isValidFileName:{
369 value: function(fileName){ 370 value: function(fileName){
370 var status = this.isValidFileName(fileName); 371 var status = this.validateFileName(fileName);
371 if(fileName !== ""){ 372 if(fileName !== ""){
372 if(!status){ 373 if(!status){
373 this.showError("! Invalid file name."); 374 this.showError("! Invalid file name.");
@@ -399,7 +400,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
399 /*** 400 /***
400 * file name validation 401 * file name validation
401 */ 402 */
402 isValidFileName:{ 403 validateFileName:{
403 value: function(fileName){ 404 value: function(fileName){
404 var status = false; 405 var status = false;
405 if(fileName !== ""){ 406 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
44 this.model.projectTypeData = this.loadDescriptor("js/io/templates/descriptor.json"); 44 this.model.projectTypeData = this.loadDescriptor("js/io/templates/descriptor.json");
45 45