aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-11 15:00:36 -0700
committerValerio Virgillito2012-05-11 15:00:36 -0700
commitf4c4bc7971a50f9e258d1ac23c70f8ea8cfe5dd6 (patch)
tree297cc2bdd26c5a72bd88edf6d91be8ceef25e98b /js/controllers
parent2b718df00eb9f3a3d2ad269fab533967668988bf (diff)
parent1fb663b5f348fe2ff5ce86a80e8a61be289eba70 (diff)
downloadninja-f4c4bc7971a50f9e258d1ac23c70f8ea8cfe5dd6.tar.gz
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into dom-architecture
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