aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-11 14:41:20 -0700
committerJose Antonio Marquez2012-05-11 14:41:20 -0700
commitc87e538fdc337639bc4d54bb087dbf2b4f20297f (patch)
treebbbcf496841932261b21f977061fd41c01c0e0a6 /js/controllers
parentf10bec0c594c6404eec51dc1a005f7f17570ba52 (diff)
downloadninja-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/controllers')
-rwxr-xr-xjs/controllers/document-controller.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 0fd13be2..d88059ab 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -99,7 +99,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
99 //console.log(request); 99 //console.log(request);
100 //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); 100 //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url);
101 //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; 101 //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]};
102 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-web/'))[1]}; 102 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/'))[1]};
103 } 103 }
104 } 104 }
105 }, 105 },
@@ -244,20 +244,20 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
244 } 244 }
245 }, 245 },
246 246
247
248
249 ////////////////////////////////////////////////////////////////////
250 //
247 createNewFile:{ 251 createNewFile:{
248 value:function(newFileObj){ 252 value:function(newFileObj){
249 //console.log(newFileObj);//contains the template uri and the new file uri 253 //
250 if(!newFileObj) return; 254 if(!newFileObj) return;
251 this.application.ninja.ioMediator.fileNew(newFileObj.newFilePath, newFileObj.fileTemplateUri, this.openNewFileCallback.bind(this)); 255 //
252 256 this.application.ninja.ioMediator.fileNew(newFileObj.newFilePath, newFileObj.fileTemplateUri, this.openNewFileCallback.bind(this), newFileObj.template);
253 if((newFileObj.fileExtension !== ".html") && (newFileObj.fileExtension !== ".htm")){//open code view
254
255 } else {
256 //open design view
257 }
258 } 257 }
259 }, 258 },
260 259 ////////////////////////////////////////////////////////////////////
260
261 /** 261 /**
262 * Public method 262 * Public method
263 * doc contains: 263 * doc contains:
@@ -374,6 +374,12 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
374 }, 374 },
375 openWebDocument: { 375 openWebDocument: {
376 value: function(doc) { 376 value: function(doc) {
377 var template, dimensions;
378 if (doc.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) {
379 dimensions = (doc.content.body.split('Ninja-Banner Dimensions@@@'))[1].split('-->')[0].split('x');
380 dimensions = {width: parseInt(dimensions[0]), height: parseInt(dimensions[1])};
381 template = {type: 'banner', size: dimensions};
382 }
377 // TODO: HACKS to remove 383 // TODO: HACKS to remove
378 this.documentHackReference = doc; 384 this.documentHackReference = doc;
379 document.getElementById("iframeContainer").style.overflow = "hidden"; 385 document.getElementById("iframeContainer").style.overflow = "hidden";
@@ -382,7 +388,7 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){
382 case 'html': 388 case 'html':
383 //Open in designer view 389 //Open in designer view
384 this._hackRootFlag = false; 390 this._hackRootFlag = false;
385 Montage.create(Document).init(doc, this, this._onOpenDocument, 'design'); 391 Montage.create(Document).init(doc, this, this._onOpenDocument, 'design', template);
386 break; 392 break;
387 default: 393 default:
388 //Open in code view 394 //Open in code view