aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js28
-rwxr-xr-xjs/document/document-html.js14
-rwxr-xr-xjs/document/models/base.js5
-rwxr-xr-xjs/document/templates/banner/index.html94
-rw-r--r--js/document/templates/banner/main.js (renamed from js/document/templates/montage-web/main.js)0
-rwxr-xr-xjs/document/templates/banner/package.json (renamed from js/document/templates/montage-html/package.json)0
-rwxr-xr-xjs/document/templates/html/index.html (renamed from js/document/templates/montage-web/index.html)16
-rw-r--r--js/document/templates/html/main.js (renamed from js/document/templates/montage-html/main.reel/main.js)3
-rwxr-xr-xjs/document/templates/html/package.json (renamed from js/document/templates/montage-web/package.json)0
-rwxr-xr-xjs/document/templates/montage-html/default_html.css74
-rwxr-xr-xjs/document/templates/montage-html/index.html48
-rwxr-xr-xjs/document/views/design.js90
-rw-r--r--js/io/templates/descriptor.json59
-rwxr-xr-xjs/io/templates/files/banner.txt13
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js11
-rw-r--r--js/mediators/io-mediator.js20
-rwxr-xr-xjs/panels/properties.reel/properties.js4
17 files changed, 300 insertions, 179 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
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 }
diff --git a/js/document/models/base.js b/js/document/models/base.js
index ebfb73b8..0f58e75c 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -62,6 +62,11 @@ exports.BaseDocumentModel = Montage.create(Component, {
62 }, 62 },
63 //////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////
64 // 64 //
65 fileTemplate: {
66 value: null
67 },
68 ////////////////////////////////////////////////////////////////////
69 //
65 parentContainer: { 70 parentContainer: {
66 value: null 71 value: null
67 }, 72 },
diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html
new file mode 100755
index 00000000..2cd82f51
--- /dev/null
+++ b/js/document/templates/banner/index.html
@@ -0,0 +1,94 @@
1<!DOCTYPE html>
2<!-- <copyright>
3 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
5 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
6 </copyright> -->
7
8
9<!--
10 NOTE(s):
11 All elements in the head of the document to be exclude from I/O
12 must set the 'data-ninja-template'
13 data-ninja-template="true"
14-->
15<html>
16
17 <head>
18
19 <style type="text/css" id="nj-stage-stylesheet" data-ninja-template="true">
20 * {
21 -webkit-transition-duration: 0s !important;
22 -webkit-animation-duration: 0s !important;
23 -webkit-animation-name: none !important;
24 }
25
26 body {
27 margin: 0;
28 padding: 0;
29 position: absolute;
30 -webkit-transform-style: preserve-3d;
31 -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
32 }
33
34 html {
35 overflow: scroll;
36 }
37
38 html, body {
39 width: 100%;
40 height: 100%;
41 background: #666;
42 }
43
44 ninjaloadinghack {
45 display: none;
46 }
47
48 .active-element-outline {