diff options
author | Jose Antonio Marquez | 2012-05-11 14:41:20 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-11 14:41:20 -0700 |
commit | c87e538fdc337639bc4d54bb087dbf2b4f20297f (patch) | |
tree | bbbcf496841932261b21f977061fd41c01c0e0a6 /js/document/document-html.js | |
parent | f10bec0c594c6404eec51dc1a005f7f17570ba52 (diff) | |
download | ninja-c87e538fdc337639bc4d54bb087dbf2b4f20297f.tar.gz |
Adding support for new templates
This is supported for NEW and OPEN, SAVE is not supported yet by I/O. Saving works, but it will not be a banner template.
Diffstat (limited to 'js/document/document-html.js')
-rwxr-xr-x | js/document/document-html.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index e00333f0..7e1f1806 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -63,13 +63,14 @@ exports.HtmlDocument = Montage.create(Component, { | |||
63 | //////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////// |
64 | // | 64 | // |
65 | init: { | 65 | init: { |
66 | value:function(file, context, callback, view, template) { //TODO: Add template support logic | 66 | value:function(file, context, callback, view, template) { |
67 | //Storing callback data for loaded dispatch | 67 | //Storing callback data for loaded dispatch |
68 | this.loaded.callback = callback; | 68 | this.loaded.callback = callback; |
69 | this.loaded.context = context; | 69 | this.loaded.context = context; |
70 | //Creating instance of HTML Document Model | 70 | //Creating instance of HTML Document Model |
71 | this.model = Montage.create(HtmlDocumentModel,{ | 71 | this.model = Montage.create(HtmlDocumentModel,{ |
72 | file: {value: file}, | 72 | file: {value: file}, |
73 | fileTemplate: {value: template}, | ||
73 | parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach | 74 | parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach |
74 | views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic | 75 | views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic |
75 | }); | 76 | }); |
@@ -97,8 +98,13 @@ exports.HtmlDocument = Montage.create(Component, { | |||
97 | this.model.views.design.render(function () { | 98 | this.model.views.design.render(function () { |
98 | //TODO: Identify and remove usage of '_document' | 99 | //TODO: Identify and remove usage of '_document' |
99 | this._document = this.model.views.design.document; | 100 | this._document = this.model.views.design.document; |
100 | //TODO: Remove usage, seems as not needed | 101 | //TODO: Remove usage, seems as not needed |
101 | this.documentRoot = this.model.views.design.document.body; | 102 | if (template && template.type === 'banner') { |
103 | //this.documentRoot = this.model.views.design.document.body; | ||
104 | this.documentRoot = this.model.views.design.document.body.getElementsByTagName('ninja-banner')[0]; | ||
105 | } else { | ||
106 | this.documentRoot = this.model.views.design.document.body; | ||
107 | } | ||
102 | //TODO: Why is this needed? | 108 | //TODO: Why is this needed? |
103 | this._liveNodeList = this.model.views.design.document.body.getElementsByTagName('*'); | 109 | this._liveNodeList = this.model.views.design.document.body.getElementsByTagName('*'); |
104 | //Initiliazing document model | 110 | //Initiliazing document model |
@@ -106,7 +112,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
106 | //Adding observer to know when template is ready | 112 | //Adding observer to know when template is ready |
107 | this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); | 113 | this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); |
108 | this._observer.observe(this.model.views.design.document.head, {childList: true}); | 114 | this._observer.observe(this.model.views.design.document.head, {childList: true}); |
109 | }.bind(this)); | 115 | }.bind(this), template); |
110 | } else { | 116 | } else { |
111 | //TODO: Identify default view (probably code) | 117 | //TODO: Identify default view (probably code) |
112 | } | 118 | } |