aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-08-06 10:29:47 -0700
committerJose Antonio Marquez2012-08-06 10:29:47 -0700
commitc00ba985a16ca0a229089243c6e04280cbff758c (patch)
tree5dadbd58766a43b290dba2e3f569e1326b35af9a
parent9c3e71de8b49dd31c171921184c9baaa7955d586 (diff)
downloadninja-c00ba985a16ca0a229089243c6e04280cbff758c.tar.gz
Fix: Added support for code/design view switching for banner templates
Fixed a bug with toggling views on banner templates, I was not handling meta data correctly nor parsing the document between the switching. This is a temp fix, should be better implement when dynamic sizing is added to the templates.
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js4
-rwxr-xr-xjs/document/document-html.js8
2 files changed, 10 insertions, 2 deletions
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 098e9e68..88c4a24b 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -246,7 +246,7 @@ exports.DocumentBar = Montage.create(Component, {
246 file: this._currentDocument.model.file, 246 file: this._currentDocument.model.file,
247 webgl: this._currentDocument.model.webGlHelper.glData, 247 webgl: this._currentDocument.model.webGlHelper.glData,
248 styles: this._currentDocument.model.getStyleSheets(), 248 styles: this._currentDocument.model.getStyleSheets(),
249 template: this._currentDocument.fileTemplate, 249 template: this._currentDocument.model.fileTemplate,
250 document: this._currentDocument.model.views.design.iframe.contentWindow.document, 250 document: this._currentDocument.model.views.design.iframe.contentWindow.document,
251 head: this._currentDocument.model.views.design.iframe.contentWindow.document.head, 251 head: this._currentDocument.model.views.design.iframe.contentWindow.document.head,
252 body: this._currentDocument.model.views.design.iframe.contentWindow.document.body, 252 body: this._currentDocument.model.views.design.iframe.contentWindow.document.body,
@@ -256,7 +256,7 @@ exports.DocumentBar = Montage.create(Component, {
256 doc = this._currentDocument.model.views.code.textArea.value; 256 doc = this._currentDocument.model.views.code.textArea.value;
257 } 257 }
258 //Reloading the document from changes made 258 //Reloading the document from changes made
259 this._currentDocument.reloadView(view, this.fileTemplate, doc); 259 this._currentDocument.reloadView(view, doc.template, doc);
260 } 260 }
261 } 261 }
262 }, 262 },
diff --git a/js/document/document-html.js b/js/document/document-html.js
index f3163339..d610c69d 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -157,6 +157,14 @@ exports.HtmlDocument = Montage.create(Component, {
157 this.model.views.design.show(); 157 this.model.views.design.show();
158 this.model.views.design.iframe.style.opacity = 0; 158 this.model.views.design.iframe.style.opacity = 0;
159 this.model.views.design.content = this.application.ninja.ioMediator.tmplt.parseHtmlToNinjaTemplate(doc); 159 this.model.views.design.content = this.application.ninja.ioMediator.tmplt.parseHtmlToNinjaTemplate(doc);
160 //
161 if (!template) {
162 if (this.model.views.design.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) {
163 dimensions = (this.model.views.design.content.body.split('Ninja-Banner Dimensions@@@'))[1].split('-->')[0].split('x');
164 dimensions = {width: parseInt(dimensions[0]), height: parseInt(dimensions[1])};
165 template = {type: 'banner', size: dimensions};
166 }
167 }
160 //TODO: Improve reference (probably through binding values) 168 //TODO: Improve reference (probably through binding values)
161 this.model.views.design._webGlHelper = this.model.webGlHelper; 169 this.model.views.design._webGlHelper = this.model.webGlHelper;
162 //Rendering design view, using observers to know when template is ready 170 //Rendering design view, using observers to know when template is ready