diff options
Diffstat (limited to 'js/io/ui/new-file-dialog')
3 files changed, 40 insertions, 46 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..0e1e09a4 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,30 @@ 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: { | ||
24 | enumerable: false, | ||
25 | value: function() {} | ||
26 | }, | ||
27 | |||
28 | draw: { | ||
29 | enumerable: false, | ||
30 | value: function() {} | ||
31 | }, | ||
32 | |||
33 | didDraw: { | 21 | didDraw: { |
34 | enumerable: false, | ||
35 | value: function() { | 22 | value: function() { |
36 | var that=this; | ||
37 | |||
38 | this.fileInputField.selectDirectory = true; | 23 | this.fileInputField.selectDirectory = true; |
39 | 24 | ||
40 | this.newFileName.addEventListener("keyup", function(evt){that.handleNewFileNameOnkeyup(evt);}, false); | 25 | this.newFileName.addEventListener("keyup", this, false); |
41 | } | 26 | } |
42 | |||
43 | }, | 27 | }, |
44 | 28 | ||
45 | handleNewFileNameOnkeyup:{ | 29 | handleKeyup:{ |
46 | value:function(evt){ | 30 | value:function(evt){ |
47 | if(this.newFileName.value !== ""){ | 31 | if(this.newFileName.value !== "") { |
48 | var newFileNameSetEvent = document.createEvent("Events"); | 32 | var newFileNameSetEvent = document.createEvent("Events"); |
49 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); | 33 | newFileNameSetEvent.initEvent("newFileNameSet", false, false); |
50 | newFileNameSetEvent.newFileName = this.newFileName.value; | 34 | newFileNameSetEvent.newFileName = this.newFileName.value; |
51 | this.eventManager.dispatchEvent(newFileNameSetEvent); | 35 | this.eventManager.dispatchEvent(newFileNameSetEvent); |
52 | } | 36 | } |
53 | } | 37 | } |
54 | } | 38 | } |
55 | 39 | ||
56 | }); \ No newline at end of file | 40 | }); \ 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 11b322fe..aaf39005 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 | |||
@@ -47,14 +47,36 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
47 | enumerable:false, | 47 | enumerable:false, |
48 | value:"0 px" | 48 | value:"0 px" |
49 | }, | 49 | }, |
50 | willDraw: { | 50 | |
51 | enumerable: false, | 51 | // Populating the directory input field with the default save location or the last stored location. |
52 | value: function() {} | 52 | prepareForDraw: { |
53 | }, | 53 | value: function() { |
54 | draw: { | 54 | var defaultSaveDirectory; |
55 | enumerable: false, | 55 | |
56 | value: function() {} | 56 | // Using session storage location |
57 | if(window.sessionStorage) { | ||
58 | var storedFolder = window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection"); | ||
59 | if(storedFolder) defaultSaveDirectory = decodeURI(window.sessionStorage.getItem("lastOpenedFolderURI_folderSelection")); | ||
60 | } | ||
61 | |||
62 | // Use default if none found in session storage | ||
63 | if(!defaultSaveDirectory) { | ||
64 | var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); | ||
65 | if(driveData.success){ | ||
66 | var topLevelDirectories = (JSON.parse(driveData.content)).children; | ||
67 | defaultSaveDirectory = topLevelDirectories[0].uri; | ||
68 | } else { | ||
69 | console.log("** Error ** Cannot get directory listing"); | ||
70 | defaultSaveDirectory = ""; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | // Set the input field to the correct directory | ||
75 | this.newFileLocation.fileInputField.newFileDirectory.value = defaultSaveDirectory; | ||
76 | this.newFileDirectory = defaultSaveDirectory; | ||
77 | } | ||
57 | }, | 78 | }, |
79 | |||
58 | didDraw: { | 80 | didDraw: { |
59 | enumerable: false, | 81 | enumerable: false, |
60 | value: function() { | 82 | value: function() { |
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; |