diff options
author | Ananya Sen | 2012-02-02 17:45:22 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-02 17:45:22 -0800 |
commit | 6890662caba94598675679f40dbb725301c93e98 (patch) | |
tree | d1e3ded939e41a2b484a4c98b48e3b3976a71c63 /js/io/ui | |
parent | 476a25e8a662270dfe5b37c560e4235f02b146e4 (diff) | |
download | ninja-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>
Diffstat (limited to 'js/io/ui')
7 files changed, 82 insertions, 127 deletions
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; |
58 | } | 58 | } |
59 | 59 | ||
60 | .newfileLocation .fileExtension{ | ||
61 | color:#d7d7d7; | ||
62 | } | ||
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html index d7fbc235..8c0327eb 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html | |||
@@ -76,14 +76,18 @@ | |||
76 | <div class="template"></div> | 76 | <div class="template"></div> |
77 | </div> | 77 | </div> |
78 | <div class="locationSelection"> | 78 | <div class="locationSelection"> |
79 | <div><span class="nameText">NAME:</span><input id="newFileName" class="nj-skinned newFileName" type="search" value="" /></div> | 79 | <div> |
80 | <span class="nameText">NAME:</span> | ||
81 | <input id="newFileName" class="nj-skinned newFileName" type="search" value="" /> | ||
82 | <span class="fileExtension"></span> | ||
83 | </div> | ||
80 | <div> | 84 | <div> |
81 | <span>DIRECTORY:</span> | 85 | <span>DIRECTORY:</span> |
82 | <div id="fileInputField"></div> | 86 | <div id="fileInputField"></div> |
83 | </div> | 87 | </div> |
84 | <br /> | 88 | <br /> |
85 | <div><span>WIDTH:</span><span class="templatePx" id="templateWidth"></span></div> | 89 | <div style="display:none;"><span>WIDTH:</span><span class="templatePx" id="templateWidth"></span></div> |
86 | <div><span>HEIGHT:</span><span class="templatePx" id="templateHeight"></span></div> | 90 | <div style="display:none;"><span>HEIGHT:</span><span class="templatePx" id="templateHeight"></span></div> |
87 | </div> | 91 | </div> |
88 | </div> | 92 | </div> |
89 | </body> | 93 | </body> |
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css index 7ef6d2ce..95ce01f9 100755 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css | |||
@@ -153,4 +153,8 @@ | |||
153 | border:2px solid #a1a1a1; | 153 | border:2px solid #a1a1a1; |
154 | background-image:none; | 154 | background-image:none; |
155 | cursor:auto; | 155 | cursor:auto; |
156 | } | ||
157 | |||
158 | .newfile .atree ul{ | ||
159 | -webkit-padding-start: 10px; | ||
156 | } \ No newline at end of file | 160 | } \ No newline at end of file |
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html index eb4a8045..c9178d65 100755 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html | |||
@@ -70,7 +70,7 @@ | |||
70 | <div id="newfile" class="newfile"> | 70 | <div id="newfile" class="newfile"> |
71 | <div class="title">Create New File</div> | 71 | <div class="title">Create New File</div> |
72 | <div class="container left-nav"> | 72 | <div class="container left-nav"> |
73 | <div class="projectTypeHeader"><span>File Type</span></div> | 73 | <div class="projectTypeHeader"><span>Choose Type</span></div> |
74 | <div id="projectTypeTree" class="projectTypeTree"></div> | 74 | <div id="projectTypeTree" class="projectTypeTree"></div> |
75 | </div> | 75 | </div> |
76 | <div class="container right-nav"> | 76 | <div class="container right-nav"> |
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 a747b8de..467c5452 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 | |||
@@ -92,6 +92,14 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
92 | 92 | ||
93 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; | 93 | this.selectedProjectType = {"uri":this.newFileModel.defaultProjectType, "element":null}; |
94 | } | 94 | } |
95 | |||
96 | //update file Extension | ||
97 | if(!!this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension){ | ||
98 | var fileExtensionEl = this.element.querySelector(".fileExtension"); | ||
99 | if(!!fileExtensionEl){ | ||
100 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[this.newFileModel.defaultProjectType].fileExtension; | ||
101 | } | ||
102 | } | ||
95 | } | 103 | } |
96 | 104 | ||
97 | }, | 105 | }, |
@@ -128,7 +136,15 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
128 | 136 | ||
129 | //clear current template selection | 137 | //clear current template selection |
130 | if((!!this.selectedTemplate) && (this.selectedTemplate.element.classList.contains("selected"))){ | 138 | if((!!this.selectedTemplate) && (this.selectedTemplate.element.classList.contains("selected"))){ |
131 | this.selectedTemplate.element.classList.remove("selected"); | 139 | this.selectedTemplate.element.classList.remove("selected"); |
140 | } | ||
141 | |||
142 | //update file Extension | ||
143 | if(!!this.newFileModel.projectTypeData[evt.uri].fileExtension){ | ||
144 | var fileExtensionEl = this.element.querySelector(".fileExtension"); | ||
145 | if(!!fileExtensionEl){ | ||
146 | fileExtensionEl.innerHTML = ""+this.newFileModel.projectTypeData[evt.uri].fileExtension; | ||
147 | } | ||
132 | } | 148 | } |
133 | 149 | ||
134 | //disable ok | 150 | //disable ok |
@@ -186,6 +202,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
186 | projectWidth = this.newFileLocation.templateWidth, | 202 | projectWidth = this.newFileLocation.templateWidth, |
187 | projectHeight = this.newFileLocation.templateHeight, | 203 | projectHeight = this.newFileLocation.templateHeight, |
188 | 204 | ||
205 | newFilePath = "", fileExtension=this.newFileModel.projectTypeData[selectedProjectTypeID].fileExtension, | ||
189 | 206 | ||
190 | selectionlog= "selectedProjectTypeID="+selectedProjectTypeID +"\n"+ | 207 | selectionlog= "selectedProjectTypeID="+selectedProjectTypeID +"\n"+ |
191 | "templateID="+templateID+ "\n"+ | 208 | "templateID="+templateID+ "\n"+ |
@@ -194,29 +211,30 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
194 | "projectWidth="+projectWidth+"\n"+ | 211 | "projectWidth="+projectWidth+"\n"+ |
195 | "projectHeight="+projectHeight; | 212 | "projectHeight="+projectHeight; |
196 | 213 | ||
214 | |||
215 | if(/[^/\\]$/g.test(projectDirectory)){ | ||
216 | projectDirectory = projectDirectory + "/"; | ||
217 | } | ||
218 | if(!!fileExtension && (projectName.lastIndexOf(fileExtension) !== (projectName.length - fileExtension.length))){ | ||
219 | projectName = projectName+fileExtension; | ||
220 | } | ||
221 | newFilePath = "" + projectDirectory + projectName; | ||
222 | |||
223 | |||
197 | if(!!this.selectedProjectType && !!this.selectedTemplate | 224 | if(!!this.selectedProjectType && !!this.selectedTemplate |
198 | && this.isValidFileName(projectName) && this.isValidUri(projectDirectory) | 225 | && this.isValidFileName(projectName) && this.isValidUri(projectDirectory) |
199 | && !this.checkFileExists(projectName, projectDirectory, this.selectedProjectType) | 226 | && !this.checkFileExists(projectName, projectDirectory, this.selectedProjectType) |
200 | ){ | 227 | ){ |
201 | this.error.innerHTML=""; | 228 | this.error.innerHTML=""; |
202 | console.log("$$$ new file selections: \n" + selectionlog); | 229 | //console.log("$$$ new file selections: \n" + selectionlog); |
203 | if(!!this.newFileModel.callback && !!this.newFileModel.callbackScope){//inform document-controller if save successful | 230 | if(!!this.newFileModel.callback && !!this.newFileModel.callbackScope){//inform document-controller if save successful |
204 | this.newFileModel.callback.call(this.newFileModel.callbackScope, {"selectedProjectTypeID":selectedProjectTypeID, | 231 | this.newFileModel.callback.call(this.newFileModel.callbackScope, {"fileTemplateUri":selectedProjectTypeID, |
205 | "templateID":templateID, | 232 | "newFilePath":newFilePath});//document-controller api |
206 | "projectName": projectName, | ||
207 | "projectDirectory":projectDirectory, | ||
208 | "projectWidth":projectWidth, | ||
209 | "projectHeight":projectHeight});//document-controller api | ||
210 | }else{ |