diff options
author | Valerio Virgillito | 2012-04-18 17:24:40 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-18 17:24:40 -0700 |
commit | c58dc96130c7eb5d964af53e9ad6e80bba5e647f (patch) | |
tree | 350303f9731ec1fa7647a22181247ab79301d1e0 /js | |
parent | 9284c19f076dec3b47ece7dc7bcd22d74e4246c3 (diff) | |
download | ninja-c58dc96130c7eb5d964af53e9ad6e80bba5e647f.tar.gz |
initial stage web template
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 30 | ||||
-rwxr-xr-x | js/data/menu-data.js | 61 | ||||
-rwxr-xr-x | js/document/html-document.js | 222 | ||||
-rwxr-xr-x | js/document/templates/montage-web/default_html.css | 30 | ||||
-rwxr-xr-x | js/document/templates/montage-web/index.html | 41 | ||||
-rw-r--r-- | js/document/templates/montage-web/main.reel/main.js | 48 | ||||
-rwxr-xr-x | js/document/templates/montage-web/package.json | 8 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 1 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 2 |
10 files changed, 409 insertions, 38 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index f35972b6..45a4d217 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -58,7 +58,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
58 | createContainerElements: { | 58 | createContainerElements: { |
59 | value: function() { | 59 | value: function() { |
60 | var parentNode; | 60 | var parentNode; |
61 | 61 | /* | |
62 | this.containerElements.length = 0; | 62 | this.containerElements.length = 0; |
63 | 63 | ||
64 | parentNode = this.container; | 64 | parentNode = this.container; |
@@ -70,7 +70,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
70 | 70 | ||
71 | // This is always the top container which is now hardcoded to body | 71 | // This is always the top container which is now hardcoded to body |
72 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); | 72 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); |
73 | 73 | */ | |
74 | 74 | ||
75 | 75 | ||
76 | } | 76 | } |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index ddaeb061..e56c3e31 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -10,8 +10,7 @@ var Montage = require("montage/core/core").Montage, | |||
10 | Component = require("montage/ui/component").Component, | 10 | Component = require("montage/ui/component").Component, |
11 | Uuid = require("montage/core/uuid").Uuid, | 11 | Uuid = require("montage/core/uuid").Uuid, |
12 | HTMLDocument = require("js/document/html-document").HTMLDocument, | 12 | HTMLDocument = require("js/document/html-document").HTMLDocument, |
13 | TextDocument = require("js/document/text-document").TextDocument, | 13 | TextDocument = require("js/document/text-document").TextDocument; |
14 | DocumentController; | ||
15 | //////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////// |
16 | // | 15 | // |
17 | var DocumentController = exports.DocumentController = Montage.create(Component, { | 16 | var DocumentController = exports.DocumentController = Montage.create(Component, { |
@@ -19,6 +18,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
19 | value: false | 18 | value: false |
20 | }, | 19 | }, |
21 | 20 | ||
21 | webTemplate: { | ||
22 | value: false | ||
23 | }, | ||
24 | |||
22 | _documents: { | 25 | _documents: { |
23 | value: [] | 26 | value: [] |
24 | }, | 27 | }, |
@@ -65,6 +68,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
65 | this.eventManager.addEventListener("styleSheetDirty", this, false); | 68 | this.eventManager.addEventListener("styleSheetDirty", this, false); |
66 | 69 | ||
67 | this.eventManager.addEventListener("addComponentFirstDraw", this, false); | 70 | this.eventManager.addEventListener("addComponentFirstDraw", this, false); |
71 | |||
72 | // Temporary add listeners for the new stage templates | ||
73 | this.eventManager.addEventListener("executeWebpageOpen", this, false); | ||
74 | this.eventManager.addEventListener("executeNewWebpage", this, false); | ||
68 | } | 75 | } |
69 | }, | 76 | }, |
70 | 77 | ||
@@ -130,6 +137,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
130 | } | 137 | } |
131 | }, | 138 | }, |
132 | 139 | ||
140 | handleExecuteWebpageOpen: { | ||
141 | value: function(event) { | ||
142 | this.webTemplate = true; | ||
143 | this.handleExecuteFileOpen(event); | ||
144 | } | ||
145 | }, | ||
146 | |||
147 | handleExecuteNewWebpage: { | ||
148 | value: function(event) { | ||
149 | this.webTemplate = true; | ||
150 | this.handleExecuteNewFile(event); | ||
151 | } | ||
152 | }, | ||
153 | |||
133 | handleExecuteNewFile: { | 154 | handleExecuteNewFile: { |
134 | value: function(event) { | 155 | value: function(event) { |
135 | var newFileSettings = event._event.settings || {}; | 156 | var newFileSettings = event._event.settings || {}; |
@@ -235,7 +256,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
235 | this.creatingNewFile = true;//flag for timeline to identify new file flow | 256 | this.creatingNewFile = true;//flag for timeline to identify new file flow |
236 | 257 | ||
237 | this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); | 258 | this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); |
238 | }else if(!!response && !response.success){ | 259 | } else if(!!response && !response.success){ |
239 | //Todo: restrict directory path to the sandbox, in the dialog itself | 260 | //Todo: restrict directory path to the sandbox, in the dialog itself |
240 | alert("Unable to create file.\n [Error: Forbidden directory]"); | 261 | alert("Unable to create file.\n [Error: Forbidden directory]"); |
241 | } | 262 | } |
@@ -313,7 +334,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
313 | switch (doc.extension) { | 334 | switch (doc.extension) { |
314 | case 'html': case 'html': | 335 | case 'html': case 'html': |
315 | //Open in designer view | 336 | //Open in designer view |
316 | Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); | 337 | Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this), this.webTemplate); |
317 | break; | 338 | break; |
318 | default: | 339 | default: |
319 | //Open in code view | 340 | //Open in code view |
@@ -420,6 +441,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
420 | // Event Detail: Contains the current ActiveDocument | 441 | // Event Detail: Contains the current ActiveDocument |
421 | _onOpenDocument: { | 442 | _onOpenDocument: { |
422 | value: function(doc){ | 443 | value: function(doc){ |
444 | this.webTemplate = false; | ||
423 | this.application.ninja.currentDocument = doc; | 445 | this.application.ninja.currentDocument = doc; |
424 | this._hideCurrentDocument(); | 446 | this._hideCurrentDocument(); |
425 | this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); | 447 | this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); |
diff --git a/js/data/menu-data.js b/js/data/menu-data.js index a1fe2703..9e8bf945 100755 --- a/js/data/menu-data.js +++ b/js/data/menu-data.js | |||
@@ -39,8 +39,7 @@ exports.MenuData = Montage.create( Montage, { | |||
39 | "boundProperty": "activeDocument", | 39 | "boundProperty": "activeDocument", |
40 | "oneway": true, | 40 | "oneway": true, |
41 | "boundValueMutator": function(activeDocument){ | 41 | "boundValueMutator": function(activeDocument){ |
42 | if(activeDocument !== null){return true;} | 42 | return activeDocument !== null; |
43 | else{return false;} | ||
44 | } | 43 | } |
45 | }, | 44 | }, |
46 | "action": "executeFileClose" | 45 | "action": "executeFileClose" |
@@ -54,8 +53,7 @@ exports.MenuData = Montage.create( Montage, { | |||
54 | "boundProperty": "activeDocument", | 53 | "boundProperty": "activeDocument", |
55 | "oneway": true, | 54 | "oneway": true, |
56 | "boundValueMutator": function(activeDocument){ | 55 | "boundValueMutator": function(activeDocument){ |
57 | if(activeDocument !== null){return true;} | 56 | return activeDocument !== null; |
58 | else{return false;} | ||
59 | } | 57 | } |
60 | }, | 58 | }, |
61 | "action": "executeFileCloseAll" | 59 | "action": "executeFileCloseAll" |
@@ -73,8 +71,7 @@ exports.MenuData = Montage.create( Montage, { | |||
73 | "boundProperty": "activeDocument", | 71 | "boundProperty": "activeDocument", |
74 | "oneway": true, | 72 | "oneway": true, |
75 | "boundValueMutator": function(activeDocument){ | 73 | "boundValueMutator": function(activeDocument){ |
76 | if(activeDocument !== null){return true;} | 74 | return activeDocument !== null; |
77 | else{return false;} | ||
78 | } | 75 | } |
79 | }, | 76 | }, |
80 | "action": "executeSave" | 77 | "action": "executeSave" |
@@ -87,9 +84,8 @@ exports.MenuData = Montage.create( Montage, { | |||
87 | "boundObj": "documentController", | 84 | "boundObj": "documentController", |
88 | "boundProperty": "activeDocument", | 85 | "boundProperty": "activeDocument", |
89 | "oneway": true, | 86 | "oneway": true, |
90 | "boundValueMutator": function(activeDocument){ | 87 | "boundValueMutator": function(activeDocument) { |
91 | if(activeDocument !== null){return true;} | 88 | return activeDocument !== null; |
92 | else{return false;} | ||
93 | } | 89 | } |
94 | }, | 90 | }, |
95 | "action":"executeSaveAs" | 91 | "action":"executeSaveAs" |
@@ -103,8 +99,7 @@ exports.MenuData = Montage.create( Montage, { | |||
103 | "boundProperty": "activeDocument", | 99 | "boundProperty": "activeDocument", |
104 | "oneway": true, | 100 | "oneway": true, |
105 | "boundValueMutator": function(activeDocument){ | 101 | "boundValueMutator": function(activeDocument){ |
106 | if(activeDocument !== null){return true;} | 102 | return activeDocument !== null; |
107 | else{return false;} | ||
108 | } | 103 | } |
109 | }, | 104 | }, |
110 | "action": "executeSaveAll" | 105 | "action": "executeSaveAll" |
@@ -127,6 +122,26 @@ exports.MenuData = Montage.create( Montage, { | |||
127 | "displayText" : "Close Project", | 122 | "displayText" : "Close Project", |
128 | "hasSubMenu" : false, | 123 | "hasSubMenu" : false, |
129 | "enabled": false | 124 | "enabled": false |
125 | }, | ||
126 | { | ||
127 | "displayText" : "", | ||
128 | "separator": true | ||
129 | }, | ||
130 | { | ||
131 | "displayText" : "", | ||
132 | "separator": true | ||
133 | }, | ||
134 | { | ||
135 | "displayText" : "New Webpage", | ||
136 | "hasSubMenu" : false, | ||
137 | "enabled": true, | ||
138 | "action": "executeNewWebpage" | ||