aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/document/base-document.js13
-rwxr-xr-xjs/io/document/document-controller.js36
-rwxr-xr-xjs/io/document/text-document.js4
-rwxr-xr-xjs/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html4
-rw-r--r--js/io/workflow/save-as-dialog.reel/save-as-dialog.css34
-rw-r--r--js/io/workflow/save-as-dialog.reel/save-as-dialog.html4
6 files changed, 72 insertions, 23 deletions
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js
index 44f54f78..af96c851 100755
--- a/js/io/document/base-document.js
+++ b/js/io/document/base-document.js
@@ -12,6 +12,7 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
12 /** Private Members **/ 12 /** Private Members **/
13 _name: { value: null, enumerable: false }, 13 _name: { value: null, enumerable: false },
14 _uri: { value: null, enumerable: false }, 14 _uri: { value: null, enumerable: false },
15 _externalUri: {value: null, enumerable:false},
15 _documentType: { value: null, enumerable: false }, 16 _documentType: { value: null, enumerable: false },
16 _container: {value: null, enumerable: false }, 17 _container: {value: null, enumerable: false },
17 _uuid: { value: null, enumerable: false }, 18 _uuid: { value: null, enumerable: false },
@@ -31,6 +32,11 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
31 set: function(value) { this._uri = value; } 32 set: function(value) { this._uri = value; }
32 }, 33 },
33 34
35 externalUri: {
36 get: function() { return this._externalUri; },
37 set: function(value) { this._externalUri = value; }
38 },
39
34 documentType: { 40 documentType: {
35 get: function() { return this._documentType; }, 41 get: function() { return this._documentType; },
36 set: function(value) { this._documentType = value; } 42 set: function(value) { this._documentType = value; }
@@ -68,13 +74,18 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
68 74
69 /** Base Methods **/ 75 /** Base Methods **/
70 init: { 76 init: {
71 value: function(name, uri, type, container, uuid, callback) { 77 value: function(name, uri, type, container, uuid, callback, externalUri) {
72 this.name = name; 78 this.name = name;
73 this.uri = uri; 79 this.uri = uri;
74 this.documentType = type; 80 this.documentType = type;
75 this.container = container; 81 this.container = container;
76 this.uuid = uuid; 82 this.uuid = uuid;
77 this.callback = callback; 83 this.callback = callback;
84 if(!!externalUri){
85 this.externalUri = externalUri;
86 this.container.setAttribute("data-uri", externalUri);
87 }
88
78 } 89 }
79 }, 90 },
80 91
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index bba7e0e7..7fe94c12 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -99,9 +99,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
99 if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){ 99 if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){
100 uri = uriArrayObj.uri[0]; 100 uri = uriArrayObj.uri[0];
101 } 101 }
102 console.log("URI is: ", uri); 102 //console.log("URI is: ", uri);
103 103
104 // Get file from Jose Code with a callback to here
105 if(!!uri){ 104 if(!!uri){
106 response = this.application.ninja.coreIoApi.openFile({"uri":uri}); 105 response = this.application.ninja.coreIoApi.openFile({"uri":uri});
107 if((response.success === true) && ((response.status === 200) || (response.status === 304))){ 106 if((response.success === true) && ((response.status === 200) || (response.status === 304))){
@@ -113,7 +112,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
113 if(uri.indexOf('.') != -1){ 112 if(uri.indexOf('.') != -1){
114 fileType = uri.substr(uri.lastIndexOf('.') + 1); 113 fileType = uri.substr(uri.lastIndexOf('.') + 1);
115 } 114 }
116 this.openDocument({"type": ""+fileType, "name": ""+filename, "source": fileContent}); 115 this.openDocument({"type": ""+fileType, "name": ""+filename, "source": fileContent, "externalUri": uri});
117 } 116 }
118 117
119 } 118 }
@@ -124,7 +123,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
124 value: function(uri) { 123 value: function(uri) {
125 console.log("URI is: ", uri); 124 console.log("URI is: ", uri);
126 125
127 // Get project from Jose Code with a callback to here
128 } 126 }
129 }, 127 },
130 128
@@ -158,18 +156,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
158 } 156 }
159 }, 157 },
160 158
161 // Document has been loaded into the Iframe. Dispatch the event.
162 // Event Detail: Contains the current ActiveDocument
163 _onOpenDocument: {
164 value: function(doc){
165
166 DocumentController.activeDocument = doc;
167
168 NJevent("onOpenDocument", doc);
169
170 }
171 },
172
173 textDocumentOpened: { 159 textDocumentOpened: {
174 value: function(doc) { 160 value: function(doc) {
175 161
@@ -209,13 +195,31 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
209 195
210 closeDocument: { 196 closeDocument: {
211 value: function(id) { 197 value: function(id) {
198
199 //if file dirty then save
200
212 var doc = this._findDocumentByUUID(id); 201 var doc = this._findDocumentByUUID(id);
213 this._removeDocumentView(doc.container); 202 this._removeDocumentView(doc.container);
214 203
215 this._documents.splice(this._findIndexByUUID(id), 1); 204 this._documents.splice(this._findIndexByUUID(id), 1);
216 205
217 if(this.activeDocument.uuid === id && this._documents.length > 0) { 206 if(this.activeDocument.uuid === id && this._documents.length > 0) {
207
208 var closeDocumentIndex = this._findIndexByUUID(id);
209 var nextDocumentIndex = -1 ;
210 if((this._documents.length > 0) && (closeDocumentIndex === 0)){
211 nextDocumentIndex = 1;
212 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){
213 nextDocumentIndex = closeDocumentIndex - 1;
214 }
215
216 //remove the codemirror div if this is for a code view
217 /////test
218
219 ////end- test
220
218 this.switchDocument(this._documents[0].uuid); 221 this.switchDocument(this._documents[0].uuid);
222
219 } 223 }
220 } 224 }
221 }, 225 },
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js
index 599d311c..a9081cb5 100755
--- a/js/io/document/text-document.js
+++ b/js/io/document/text-document.js
@@ -45,10 +45,10 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base
45 // PUBLIC METHODS 45 // PUBLIC METHODS
46 initialize: { 46 initialize: {
47 value: function(doc, uuid, textArea, callback) { 47 value: function(doc, uuid, textArea, callback) {
48 this.init(doc.name, doc.uri, doc.type, textArea, uuid); 48 this.init(doc.name, doc.uri, doc.type, textArea, uuid, null, doc.externalUri);
49
50 this.currentView = "code"; 49 this.currentView = "code";
51 this.textArea = textArea; 50 this.textArea = textArea;
51
52// this._loadContent(); 52// this._loadContent();
53 } 53 }
54 }, 54 },
diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html
index 36e937e0..dc090b99 100755
--- a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html
+++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html
@@ -84,8 +84,8 @@
84 </div> 84 </div>
85 <div class="errorMsg"><span id="error" class="error"></span></div> 85 <div class="errorMsg"><span id="error" class="error"></span></div>
86 <div class="buttons"> 86 <div class="buttons">
87 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton" /> 87 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton nj-skinned" />
88 <input id="okButton" disabled="true" type="button" value="OK" class="okButton" /> 88 <input id="okButton" disabled="true" type="button" value="OK" class="okButton nj-skinned" />
89 </div> 89 </div>
90</div> 90</div>
91</body> 91</body>
diff --git a/js/io/workflow/save-as-dialog.reel/save-as-dialog.css b/js/io/workflow/save-as-dialog.reel/save-as-dialog.css
index 7082f485..40434c25 100644
--- a/js/io/workflow/save-as-dialog.reel/save-as-dialog.css
+++ b/js/io/workflow/save-as-dialog.reel/save-as-dialog.css
@@ -63,4 +63,38 @@
63 63
64.saveAsDialog .fileInputField{ 64.saveAsDialog .fileInputField{
65 margin-left:3px; 65 margin-left:3px;
66}
67
68.saveAsDialog .okButton{
69 margin-right:25px;
70 -webkit-box-align: center;
71 text-align: center;
72 cursor: default;
73 padding: 0px 6px 0px;
74 border:2px solid #d1d1d1;
75 background-color: #e1e1e1;
76 box-sizing: border-box;
77 border-radius:10px;
78 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
79 cursor:pointer;
80}
81
82.saveAsDialog .cancelButton{
83 -webkit-box-align: center;
84 text-align: center;
85 cursor: default;
86 padding: 0px 6px 0px;
87 border:2px solid #d1d1d1;
88 background-color: #e1e1e1;
89 box-sizing: border-box;
90 border-radius:10px;
91 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
92 cursor:pointer;
93}
94
95.saveAsDialog input[type="button"]:disabled{