diff options
Diffstat (limited to 'js/io/ui/new-file-dialog')
-rwxr-xr-x | js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | 60 | ||||
-rwxr-xr-x | js/io/ui/new-file-dialog/new-file-workflow-controller.js | 12 |
2 files changed, 36 insertions, 36 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 fae8f9c7..849c665c 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 | |||
@@ -11,46 +11,58 @@ var newFileWorkflowControllerModule = require("js/io/ui/new-file-dialog/new-file | |||
11 | var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | 11 | var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { |
12 | 12 | ||
13 | templateHeight:{ | 13 | templateHeight:{ |
14 | enumerable: true, | ||
15 | value:"25 px" | 14 | value:"25 px" |
16 | }, | 15 | }, |
17 | 16 | ||
18 | templateWidth:{ | 17 | templateWidth:{ |
19 | enumerable: true, | ||
20 | value:"25 px" | 18 | value:"25 px" |
21 | }, | 19 | }, |
22 | 20 | ||
23 | willDraw: { | 21 | // Populating the directory input field with the default save location or the last stored location. |
24 | enumerable: false, | 22 | prepareForDraw: { |
25 | value: function() {} | 23 | value: function() { |
26 | }, | 24 | var defaultSaveDirectory; |
25 | |||
26 | // Using session storage location | ||
27 | if(window.sessionStorage) { | ||
28 | var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); | ||
29 | if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); | ||
30 | } | ||
31 | |||
32 | // Use default if none found in session storage | ||
33 | if(!defaultSaveDirectory) { | ||
34 | var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); | ||
35 | if(driveData.success){ | ||
36 | var topLevelDirectories = (JSON.parse(driveData.content)).children; | ||
37 | defaultSaveDirectory = topLevelDirectories[0].uri; | ||
38 | } else { | ||
39 | console.log("** Error ** Cannot get directory listing"); | ||
40 | defaultSaveDirectory = ""; | ||
41 | } | ||
42 | } | ||
27 | 43 | ||
28 | draw: { | 44 | // Set the input field to the correct directory |
29 | enumerable: false, | 45 | this.fileInputField.newFileDirectory.value = defaultSaveDirectory; |
30 | value: function() {} | 46 | } |
31 | }, | 47 | }, |
32 | 48 | ||
33 | didDraw: { | 49 | didDraw: { |
34 | enumerable: false, | ||
35 | value: function() { | 50 | value: function() { |
36 | var that=this; | ||
37 | |||
38 | this.fileInputField.selectDirectory = true; | 51 | this.fileInputField.selectDirectory = true; |
39 | 52 | ||
40 | this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false); | 53 | this.newFileName.addEventListener("keyup", this, false); |
41 | } | 54 | } |
42 | |||
43 | }, | 55 | }, |
44 | 56 | ||
45 | handleNewFileNameOnkeyup:{ | 57 | handleKeyup:{ |
46 | value:function(evt){ | 58 | value:function(evt){ |
47 | if(this.newFileName.value !== ""){ | 59 | if(this.newFileName.value !== "") { |
48 | var newFileNameSetEvent = document.createEvent("Events"); | 60 | var newFileNameSetEvent = document.createEvent("Events"); |
49 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | 61 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); |
50 | newFileNameSetEvent.newFileName = this.newFileName.value; | 62 | newFileNameSetEvent.newFileName = this.newFileName.value; |
51 | this.eventManager.dispatchEvent(newFileNameSetEvent); | 63 | this.eventManager.dispatchEvent(newFileNameSetEvent); |
52 | } | 64 | } |
53 | } | 65 | } |
54 | } | 66 | } |
55 | 67 | ||
56 | }); \ No newline at end of file | 68 | }); \ No newline at end of file |
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 7b7f4572..c2be687a 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 | |||
@@ -29,7 +29,6 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre | |||
29 | }, | 29 | }, |
30 | 30 | ||
31 | model:{ | 31 | model:{ |
32 | writable: true, | ||
33 | enumerable:true, | 32 | enumerable:true, |
34 | value: null | 33 | value: null |
35 | }, | 34 | }, |
@@ -56,19 +55,8 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre | |||
56 | this.model.defaultProjectType = lastSelectedProjectType; | 55 | this.model.defaultProjectType = lastSelectedProjectType; |
57 | } | 56 | } |
58 | 57 | ||
59 | //render modal dialog | ||
60 | var newFileNavContent = document.createElement("div"); | ||
61 | newFileNavContent.id = "newFileDialog"; | ||
62 | |||
63 | //elements needs to be on DOM to be drawn | ||
64 | document.getElementById('modalContainer').appendChild(newFileNavContent); | ||
65 | |||
66 | var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); | 58 | var newFileOptionsNav = newFileOptionsNavigatorModule.NewFileOptionsNavigator.create(); |
67 | newFileOptionsNav.newFileModel = this.model; | 59 | newFileOptionsNav.newFileModel = this.model; |
68 | newFileOptionsNav.element = newFileNavContent; | ||
69 | |||
70 | //remove after rendering and add in modal dialog | ||
71 | document.getElementById('modalContainer').removeChild(newFileNavContent); | ||
72 | 60 | ||
73 | var popup = Popup.create(); | 61 | var popup = Popup.create(); |
74 | popup.content = newFileOptionsNav; | 62 | popup.content = newFileOptionsNav; |