aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js2
-rwxr-xr-xjs/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html30
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js3
-rwxr-xr-xjs/io/document/base-document.js7
-rwxr-xr-xjs/io/document/document-controller.js84
-rwxr-xr-xjs/io/document/html-document.js33
-rwxr-xr-xjs/io/document/text-document.js16
-rwxr-xr-xjs/io/system/coreioapi.js9
-rwxr-xr-xjs/io/system/projectio.js2
-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.html32
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js74
-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
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.html33
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js25
-rw-r--r--js/mediators/io-mediator.js35
-rwxr-xr-xjs/ninja.reel/ninja.html8
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.css3
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js96
23 files changed, 382 insertions, 333 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index 1431e76f..2a33548a 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -101,7 +101,7 @@ exports.DocumentEntry = Montage.create(Component, {
101 this.application.ninja.documentController.closeDocument(this._uuid); 101 this.application.ninja.documentController.closeDocument(this._uuid);
102 } else { 102 } else {
103 if(!this._document.isActive) { 103 if(!this._document.isActive) {
104 this.application.ninja.stage.stageView.switchCodeView(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 104 this.application.ninja.stage.stageView.switchDocument(this.application.ninja.documentController._findDocumentByUUID(this._uuid));
105 } 105 }
106 } 106 }
107 } 107 }
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
index b5da0e6e..bd427f97 100755
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
@@ -10,36 +10,6 @@
10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css"> 10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css">
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13 "okButton": {
14 "module": "montage/ui/button.reel",
15 "name": "Button",
16 "properties": {
17 "element": {"#": "okButton"},
18 "identifier": "okButton"
19 },
20 "listeners": [
21 {
22 "type": "action",
23 "listener": {"@": "owner"}
24 }
25 ]
26 },
27
28 "cancelButton": {
29 "module": "montage/ui/button.reel",
30 "name": "Button",
31 "properties": {
32 "element": {"#": "cancelButton"},
33 "identifier": "cancelButton"
34 },
35 "listeners": [
36 {
37 "type": "action",
38 "listener": {"@": "owner"}
39 }
40 ]
41 },
42
43 "owner":{ 13 "owner":{
44 "module": "js/components/ui/FilePicker/pickerNavigator.reel", 14 "module": "js/components/ui/FilePicker/pickerNavigator.reel",
45 "name":"PickerNavigator", 15 "name":"PickerNavigator",
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index 268ec41a..d7a19c14 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -245,6 +245,9 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
245 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); 245 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false);
246 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); 246 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false);
247 247
248 this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false);
249 this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false);
250
248 //ready to show picker now 251 //ready to show picker now
249 this.element.style.visibility = "visible"; 252 this.element.style.visibility = "visible";
250 } 253 }
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js
index d3601de5..ecc92447 100755
--- a/js/io/document/base-document.js
+++ b/js/io/document/base-document.js
@@ -87,7 +87,12 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
87 value: function() { 87 value: function() {
88 // Have the XHR here? 88 // Have the XHR here?
89 } 89 }
90 } 90 },
91 91
92 save:{
93 value:function(){
94 //base function - to be overridden
95 }
96 }
92 97
93}); \ No newline at end of file 98}); \ No newline at end of file
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index d7a19e35..ca6b4533 100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -15,7 +15,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
15var Montage = require("montage/core/core").Montage, 15var Montage = require("montage/core/core").Montage,
16 Component = require("montage/ui/component").Component, 16 Component = require("montage/ui/component").Component,
17 Uuid = require("montage/core/uuid").Uuid, 17 Uuid = require("montage/core/uuid").Uuid,
18 //nj= ("js/lib/NJUtils.js").NJUtils,
19 HTMLDocument = require("js/io/document/html-document").HTMLDocument, 18 HTMLDocument = require("js/io/document/html-document").HTMLDocument,
20 TextDocument = require("js/io/document/text-document").TextDocument; 19 TextDocument = require("js/io/document/text-document").TextDocument;
21 20
@@ -71,8 +70,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
71 deserializedFromTemplate: { 70 deserializedFromTemplate: {
72 value: function() { 71 value: function() {
73 this.eventManager.addEventListener("appLoaded", this, false); 72 this.eventManager.addEventListener("appLoaded", this, false);
74
75 this.eventManager.addEventListener("executeFileOpen", this, false); 73 this.eventManager.addEventListener("executeFileOpen", this, false);
74 this.eventManager.addEventListener("executeNewFile", this, false);
76 } 75 }
77 }, 76 },
78 77
@@ -93,6 +92,46 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
93 } 92 }
94 }, 93 },
95 94
95 handleExecuteNewFile: {
96 value: function(event) {
97 var newFileSettings = event._event.settings || {};
98 newFileSettings.callback = this.createNewFile;
99 newFileSettings.callbackScope = this;
100 this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
101 }
102 },
103
104 createNewFile:{
105 value:function(newFileObj){
106 //console.log(newFileObj);//contains the template uri and the new file uri
107 if(!newFileObj) return;
108 this.application.ninja.ioMediator.fileNew(newFileObj.newFilePath, newFileObj.fileTemplateUri, {"operation":this.openNewFileCallback, "thisScope":this});
109
110 if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view
111
112 }else{
113 //open design view
114 }
115 }
116 },
117
118 /**
119 * Public method
120 * doc contains:
121 * type : file type, like js, css, etc
122 * name : file name
123 * source : file content
124 * uri : file uri
125 */
126 openNewFileCallback:{
127 value:function(doc){
128 if(!doc){
129 doc = {"type": "js", "name": "filename", "source": "test file content", "uri": "/fs/fsd/"} ;
130 }
131 this.openDocument(doc);
132 }
133 },
134
96 openFileWithURI: { 135 openFileWithURI: {
97 value: function(uriArrayObj) { 136 value: function(uriArrayObj) {
98 var uri = "", fileContent = "", response=null, filename="", fileType="js"; 137 var uri = "", fileContent = "", response=null, filename="", fileType="js";
@@ -101,20 +140,21 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
101 } 140 }
102 //console.log("URI is: ", uri); 141 //console.log("URI is: ", uri);
103 142
104 if(!!uri){ 143 this.application.ninja.ioMediator.fileOpen({"uri":uri}, {"operation":this.openFileCallback, "thisScope":this});
105 response = this.application.ninja.coreIoApi.openFile({"uri":uri}); 144 }
106 if((response.success === true) && ((response.status === 200) || (response.status === 304))){ 145 },
107 fileContent = response.content;
108 }
109
110 //console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n");
111 filename = nj.getFileNameFromPath(uri);
112 if(uri.indexOf('.') != -1){
113 fileType = uri.substr(uri.lastIndexOf('.') + 1);
114 }
115