diff options
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 38 | ||||
-rwxr-xr-x | js/document/controllers/document.js | 2 | ||||
-rwxr-xr-x | js/document/document-html.js | 304 | ||||
-rwxr-xr-x | js/document/html-document.js | 223 | ||||
-rwxr-xr-x | js/document/models/base.js | 4 | ||||
-rwxr-xr-x | js/document/models/html.js | 4 | ||||
-rwxr-xr-x | js/document/templates/montage-web/default_html.css | 11 | ||||
-rwxr-xr-x | js/document/templates/montage-web/index.html | 10 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 22 | ||||
-rwxr-xr-x | js/panels/properties.reel/properties.js | 2 |
11 files changed, 365 insertions, 259 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 45a4d217..f35972b6 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 1fcdf6d0..a7aa0de6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -11,6 +11,9 @@ var Montage = require("montage/core/core").Montage, | |||
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 | |||
15 | // New Document Objects | ||
16 | var Document = require("js/document/document-html").HtmlDocument; | ||
14 | //////////////////////////////////////////////////////////////////////// | 17 | //////////////////////////////////////////////////////////////////////// |
15 | // | 18 | // |
16 | var DocumentController = exports.DocumentController = Montage.create(Component, { | 19 | var DocumentController = exports.DocumentController = Montage.create(Component, { |
@@ -289,7 +292,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
289 | this.isNewFilePath = false;//reset path identifier flag | 292 | this.isNewFilePath = false;//reset path identifier flag |
290 | 293 | ||
291 | //Sending full response object | 294 | //Sending full response object |
292 | this.openDocument(response); | 295 | // TODO: Unify those 2 methods. Using if/else for the new template |
296 | if(this.webTemplate) { | ||
297 | this.openWebDocument(response); | ||
298 | } else { | ||
299 | this.openDocument(response); | ||
300 | } | ||
293 | } else if (!!response && (response.status === 404)){ | 301 | } else if (!!response && (response.status === 404)){ |
294 | alert("Unable to open file.\n [Error: File does not exist]"); | 302 | alert("Unable to open file.\n [Error: File does not exist]"); |
295 | } else if (!!response && (response.status === 500)){ | 303 | } else if (!!response && (response.status === 500)){ |
@@ -334,7 +342,31 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
334 | switch (doc.extension) { | 342 | switch (doc.extension) { |
335 | case 'html': | 343 | case 'html': |
336 | //Open in designer view | 344 | //Open in designer view |
337 | Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this), this.webTemplate); | 345 | Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); |
346 | break; | ||
347 | default: | ||
348 | //Open in code view | ||
349 | var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; | ||
350 | textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); | ||
351 | code.initialize(doc, docuuid, textArea, textArea.parentNode); | ||
352 | //code.init(doc.name, doc.uri, doc.extension, null, docuuid); | ||
353 | code.textArea.value = doc.content; | ||
354 | this.application.ninja.stage.stageView.createTextView(code); | ||
355 | break; | ||
356 | } | ||
357 | } | ||
358 | }, | ||
359 | openWebDocument: { | ||
360 | value: function(doc) { | ||
361 | // TODO: HACKS to remove | ||
362 | this.documentHackReference = doc; | ||
363 | document.getElementById("iframeContainer").style.overflow = "hidden"; | ||
364 | // | ||
365 | switch (doc.extension) { | ||
366 | case 'html': | ||
367 | //Open in designer view | ||
368 | this._hackRootFlag = false; | ||
369 | Montage.create(Document).init(doc, this, this._onOpenDocument); | ||
338 | break; | 370 | break; |
339 | default: | 371 | default: |
340 | //Open in code view | 372 | //Open in code view |
@@ -453,8 +485,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
453 | this._showCurrentDocument(); | 485 | this._showCurrentDocument(); |
454 | 486 | ||
455 | NJevent("onOpenDocument", doc); | 487 | NJevent("onOpenDocument", doc); |
456 | // appDelegateModule.MyAppDelegate.onSetActiveDocument(); | ||
457 | |||
458 | } | 488 | } |
459 | }, | 489 | }, |
460 | 490 | ||
diff --git a/js/document/controllers/document.js b/js/document/controllers/document.js index f7260957..feba3e0e 100755 --- a/js/document/controllers/document.js +++ b/js/document/controllers/document.js | |||
@@ -16,7 +16,7 @@ exports.DocumentController = Montage.create(Component, { | |||
16 | hasTemplate: { | 16 | hasTemplate: { |
17 | enumerable: false, | 17 | enumerable: false, |
18 | value: false | 18 | value: false |
19 | } | 19 | }, |
20 | //////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////// |
21 | // | 21 | // |
22 | save: { | 22 | save: { |
diff --git a/js/document/document-html.js b/js/document/document-html.js index b48e004a..841e66ed 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -6,8 +6,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | //////////////////////////////////////////////////////////////////////// | 7 | //////////////////////////////////////////////////////////////////////// |
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | Component = require("montage/ui/component").Component; | 10 | Component = require("montage/ui/component").Component; |
11 | HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel; | ||
11 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
12 | // | 13 | // |
13 | exports.HtmlDocument = Montage.create(Component, { | 14 | exports.HtmlDocument = Montage.create(Component, { |
@@ -16,9 +17,306 @@ exports.HtmlDocument = Montage.create(Component, { | |||
16 | hasTemplate: { | 17 | hasTemplate: { |
17 | enumerable: false, | 18 | enumerable: false, |
18 | value: false | 19 | value: false |
19 | } | 20 | }, |
21 | |||
22 | model: { | ||
23 | value: null | ||
24 | }, | ||
25 | |||
26 | loadDelegate: { | ||
27 | value: null | ||
28 | }, | ||
29 | |||
30 | delegateContext: { | ||
31 | value: null | ||
32 | }, | ||
33 | |||
34 | // Getters for the model. | ||
35 | // TODO: Change how these properties are accessed through Ninja | ||
36 | name: { | ||
37 | get: function() { | ||
38 | return this.model._name; | ||
39 | }, | ||
40 | set: function(value) { | ||
41 | this.model._name = value; | ||
42 | } | ||
43 | }, | ||
44 | |||
45 | // View Properties | ||
46 | // TODO: Move those into a view object - for now dump it here | ||
47 | iframe: { | ||
48 | value: null | ||
49 | }, | ||
50 | |||
51 | uuid: { | ||
52 | get: function() { | ||
53 | return this._uuid; | ||
54 | } | ||
55 | }, | ||
20 | //////////////////////////////////////////////////////////////////// | 56 | //////////////////////////////////////////////////////////////////// |
21 | //////////////////////////////////////////////////////////////////// | 57 | //////////////////////////////////////////////////////////////////// |
58 | init: { | ||
59 | value:function(file, context, callback) { | ||
60 | this.model = Montage.create(HtmlDocumentModel, { | ||
61 | file: { | ||
62 | value: file | ||
63 | } | ||
64 | }); | ||
65 | |||
66 | this.name = file.name; | ||
67 | |||
68 | // this.init(file.name, file.uri, file.extension, iframe, uuid, callback); | ||
69 | |||
70 | this.iframe = this.createView(); | ||
71 | this.iframe.addEventListener("load", this.handleWebTemplateLoad.bind(this), true); | ||
72 | |||
73 | //this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"]; | ||
74 | //this.currentView = "design"; | ||
75 | // | ||
76 | |||
77 | this.delegateContext = context; | ||
78 | this.loadDelegate = callback; | ||
79 | } | ||
80 | }, | ||
81 | |||
82 | // Create View | ||
83 | // Move this into a base view object | ||
84 | createView: { | ||
85 | value: function() { | ||
86 | var ifr = document.createElement("iframe"); | ||
87 | ifr.id = "document_" + this._uuid; | ||
88 | |||
89 | |||
90 | ifr.style.border = "none"; | ||
91 | ifr.style.background = "#FFF"; | ||
92 | ifr.style.height = "100%"; | ||
93 | ifr.style.width = "100%"; | ||
94 | |||
95 | // TODO: Reable opacity to display only when done loading | ||
96 | // ifr.style.opacity = 0; |