aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnanya Sen2012-02-02 17:45:22 -0800
committerAnanya Sen2012-02-02 17:45:22 -0800
commit6890662caba94598675679f40dbb725301c93e98 (patch)
treed1e3ded939e41a2b484a4c98b48e3b3976a71c63
parent476a25e8a662270dfe5b37c560e4235f02b146e4 (diff)
downloadninja-6890662caba94598675679f40dbb725301c93e98.tar.gz
integrated new file dialog with the template descriptor.json and document-controller.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-xcss/ninja.css2
-rwxr-xr-xjs/io/document/document-controller.js17
-rwxr-xr-xjs/io/system/coreioapi.js8
-rw-r--r--js/io/templates/descriptor.json64
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css7
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html10
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css4
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html2
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js48
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js37
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-model.js101
11 files changed, 147 insertions, 153 deletions
diff --git a/css/ninja.css b/css/ninja.css
index bf71955f..84600f12 100755
--- a/css/ninja.css
+++ b/css/ninja.css
@@ -72,7 +72,7 @@ body { position: absolute; margin: 0px; width: 100%; height: 100%; background-co
72 72
73#appWorkspace { display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-pack: center; -webkit-box-align: center; -webkit-box-sizing: stretch; position: relative; padding: 2px 0px; border: 1px solid #333; overflow: hidden; } 73#appWorkspace { display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-pack: center; -webkit-box-align: center; -webkit-box-sizing: stretch; position: relative; padding: 2px 0px; border: 1px solid #333; overflow: hidden; }
74 74
75#topMenu { background-color: #474747; position: absolute; height: 28px; width: 100%; top: 0px; left: 0px; z-index: 9999; } 75#topMenu { background-color: #474747; position: absolute; height: 28px; width: 100%; top: 0px; left: 0px; z-index: 6995; }
76 76
77#topPanelContainer, #leftPanelContainer, #rightPanelContainer, #bottomPanelContainer { background-color: #282828; } 77#topPanelContainer, #leftPanelContainer, #rightPanelContainer, #bottomPanelContainer { background-color: #282828; }
78 78
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index 8ce43dcc..dd62b40b 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -71,8 +71,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
71 deserializedFromTemplate: { 71 deserializedFromTemplate: {
72 value: function() { 72 value: function() {
73 this.eventManager.addEventListener("appLoaded", this, false); 73 this.eventManager.addEventListener("appLoaded", this, false);
74
75 this.eventManager.addEventListener("executeFileOpen", this, false); 74 this.eventManager.addEventListener("executeFileOpen", this, false);
75 this.eventManager.addEventListener("executeNewFile", this, false);
76 } 76 }
77 }, 77 },
78 78
@@ -93,6 +93,21 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
93 } 93 }
94 }, 94 },
95 95
96 handleExecuteNewFile: {
97 value: function(event) {
98 var newFileSettings = event._event.settings || {};
99 newFileSettings.callback = this.createNewFile;
100 newFileSettings.callbackScope = this;
101 this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
102 }
103 },
104
105 createNewFile:{
106 value:function(newFileObj){
107 //console.log(newFileObj);
108 }
109 },
110
96 openFileWithURI: { 111 openFileWithURI: {
97 value: function(uriArrayObj) { 112 value: function(uriArrayObj) {
98 var uri = "", fileContent = "", response=null, filename="", fileType="js"; 113 var uri = "", fileContent = "", response=null, filename="", fileType="js";
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index f0ca568f..e448d981 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -1009,7 +1009,7 @@ exports.CoreIoApi = Montage.create(Component, {
1009 * check if the file exists 1009 * check if the file exists
1010 */ 1010 */
1011 checkFileExists:{ 1011 checkFileExists:{
1012 value: function(fileUri, folderUri, fileType){ 1012 value: function(fileName, folderUri, fileType){
1013 var uri = "", response=null, status=true; 1013 var uri = "", response=null, status=true;
1014 1014
1015 //prepare absolute uri 1015 //prepare absolute uri
@@ -1017,9 +1017,11 @@ exports.CoreIoApi = Montage.create(Component, {
1017 folderUri = folderUri + "/"; 1017 folderUri = folderUri + "/";
1018 } 1018 }
1019 1019
1020 //todo:add file extension check if fileType present 1020 if(!!fileType && (fileName.lastIndexOf(fileType) !== (fileName.length - fileType.length))){
1021 fileName = fileName+fileType;
1022 }
1021 1023
1022 uri = ""+folderUri+fileUri; 1024 uri = ""+folderUri+fileName;
1023 1025
1024 response = this.fileExists({"uri":uri}); 1026 response = this.fileExists({"uri":uri});
1025 if(!!response && response.success && (response.status === 204)){ 1027 if(!!response && response.success && (response.status === 204)){
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
index 3d8391c5..d8fb7da4 100644
--- a/js/io/templates/descriptor.json
+++ b/js/io/templates/descriptor.json
@@ -1,51 +1,73 @@
1{ 1{
2 "categories":{ 2 "categories":{
3 "children":["newFile"] 3 "children":["/"]
4 }, 4 },
5 "newFile":{ 5 "/":{
6 "name":"Blank Template", 6 "name":"Blank File",
7 "uri":"/", 7 "uri":"/",
8 "type":"directory", 8 "type":"directory",
9 "children":["html", "js", "css", "json", "php", "pl", "py", "rb"] 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"]
10 }, 10 },
11 "html":{ 11 "files/html.txt":{
12 "name":"HTML", 12 "name":"HTML",
13 "uri":"files/html.txt", 13 "uri":"files/html.txt",
14 "type":"file" 14 "type":"file",
15 "fileExtension":".html",
16 "children":["defaultTemplate"]
15 }, 17 },
16 "js":{ 18 "files/js.txt":{
17 "name":"JavaScript", 19 "name":"JavaScript",
18 "uri":"files/js.txt", 20 "uri":"files/js.txt",
19 "type":"file" 21 "type":"file",
22 "fileExtension":".js",
23 "children":["defaultTemplate"]
20 }, 24 },
21 "css":{ 25 "files/css.txt":{
22 "name":"Cascading Style Sheets", 26 "name":"Cascading Style Sheets",
23 "uri":"files/css.txt", 27 "uri":"files/css.txt",
24 "type":"file" 28 "type":"file",
29 "fileExtension":".css",
30 "children":["defaultTemplate"]
25 }, 31 },
26 "json":{ 32 "files/json.txt":{
27 "name":"JSON", 33 "name":"JSON",
28 "uri":"files/json.txt", 34 "uri":"files/json.txt",
29 "type":"file" 35 "type":"file",
36 "fileExtension":".json",
37 "children":["defaultTemplate"]
30 }, 38 },
31 "php":{ 39 "files/php.txt":{
32 "name":"PHP", 40 "name":"PHP",
33 "uri":"files/php.txt", 41 "uri":"files/php.txt",
34 "type":"file" 42 "type":"file",
43 "fileExtension":".php",
44 "children":["defaultTemplate"]
35 }, 45 },
36 "pl":{ 46 "files/pl.txt":{
37 "name":"Perl", 47 "name":"Perl",
38 "uri":"files/pl.txt", 48 "uri":"files/pl.txt",
39 "type":"file" 49 "type":"file",
50 "fileExtension":".pl",
51 "children":["defaultTemplate"]
40 }, 52 },
41 "py":{ 53 "files/py.txt":{
42 "name":"Python", 54 "name":"Python",
43 "uri":"files/py.txt", 55 "uri":"files/py.txt",
44 "type":"file" 56 "type":"file",
57 "fileExtension":".py",
58 "children":["defaultTemplate"]
45 }, 59 },
46 "rb":{ 60 "files/rb.txt":{
47 "name":"Ruby", 61 "name":"Ruby",
48 "uri":"files/rb.txt", 62 "uri":"files/rb.txt",
49 "type":"file" 63 "type":"file",
50 } 64 "fileExtension":".rb",
65 "children":["defaultTemplate"]
66 },
67 "defaultTemplate":{
68 "name": "Basic",
69 "uri": "defaultTemplate",
70 "type":"file"
71 }
72
51} \ No newline at end of file 73} \ No newline at end of file
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css
index 7f11c225..092ca626 100755
--- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css
+++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css
@@ -5,7 +5,7 @@
5 </copyright> */ 5 </copyright> */
6 6
7.newfileLocation .newFileName{ 7.newfileLocation .newFileName{
8 width:70%; 8 width:65%;
9 margin-left:5px; 9 margin-left:5px;
10} 10}
11 11
@@ -49,7 +49,7 @@
49} 49}
50 50
51.newfileLocation .nameText{ 51.newfileLocation .nameText{
52 margin-right:31px; 52 margin-right:28px;
53} 53}
54 54
55.newfileLocation .hottextunit{ 55.newfileLocation .hottextunit{
@@ -57,3 +57,6 @@
57 display: inline; 57 display: inline;