diff options
author | Armen Kesablyan | 2012-05-17 14:01:38 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-17 14:01:38 -0700 |
commit | 6c8f3525b839e82cf43df43700a0160ee2c5458f (patch) | |
tree | 3fb801fa54b759c5568d75bb467e02652ce77c3e /js/document/templates | |
parent | e8ae5db7ce7023b638375cbc27a3f7b7a2f77b23 (diff) | |
parent | 342c97ac9b727b22a7b0bfefca4d2a168bc3055b (diff) | |
download | ninja-6c8f3525b839e82cf43df43700a0160ee2c5458f.tar.gz |
Merge branch 'refs/heads/dom-architecture' into binding
Conflicts:
css/ninja.css
scss/imports/scss/_toolbar.scss
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/document/templates')
-rw-r--r-- | js/document/templates/app/main.js (renamed from js/document/templates/banner/main.js) | 18 | ||||
-rwxr-xr-x | js/document/templates/app/package.json (renamed from js/document/templates/banner/package.json) | 1 | ||||
-rwxr-xr-x | js/document/templates/banner/index.html | 2 | ||||
-rwxr-xr-x | js/document/templates/html/index.html | 7 | ||||
-rw-r--r-- | js/document/templates/html/main.js | 49 | ||||
-rwxr-xr-x | js/document/templates/html/package.json | 8 | ||||
-rwxr-xr-x | js/document/templates/preview/banner.html | 64 |
7 files changed, 85 insertions, 64 deletions
diff --git a/js/document/templates/banner/main.js b/js/document/templates/app/main.js index d5ac88d5..a406abdb 100644 --- a/js/document/templates/banner/main.js +++ b/js/document/templates/app/main.js | |||
@@ -3,8 +3,10 @@ | |||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | var Montage = require("montage/core/core").Montage, | 6 | var Montage = require("montage/core/core").Montage, |
7 | Component = require("montage/ui/component").Component; | 7 | Component = require("montage/ui/component").Component, |
8 | Template = require("montage/ui/template").Template, | ||
9 | TemplateCreator = require("tools/template/template-creator").TemplateCreator; | ||
8 | 10 | ||
9 | exports.Main = Montage.create(Component, { | 11 | exports.Main = Montage.create(Component, { |
10 | 12 | ||
@@ -18,6 +20,7 @@ exports.Main = Montage.create(Component, { | |||
18 | templateDidLoad: { | 20 | templateDidLoad: { |
19 | value: function(){ | 21 | value: function(){ |
20 | var self = this; | 22 | var self = this; |
23 | // | ||
21 | window.addComponent = function(element, data, callback) { | 24 | window.addComponent = function(element, data, callback) { |
22 | var component; | 25 | var component; |
23 | 26 | ||
@@ -36,7 +39,16 @@ exports.Main = Montage.create(Component, { | |||
36 | .end(); | 39 | .end(); |
37 | 40 | ||
38 | }; | 41 | }; |
39 | 42 | // | |
43 | window.mjsTemplateCreator = TemplateCreator; | ||
44 | // | ||
45 | window.mjsTemplate = Template; | ||
46 | // | ||
47 | var templateEvent = document.createEvent("CustomEvent"); | ||
48 | templateEvent.initCustomEvent("mjsTemplateReady", false, true); | ||
49 | document.body.dispatchEvent(templateEvent); | ||
50 | |||
51 | |||
40 | // Dispatch event when this template has loaded. | 52 | // Dispatch event when this template has loaded. |
41 | /* | 53 | /* |
42 | var newEvent = document.createEvent( "CustomEvent" ); | 54 | var newEvent = document.createEvent( "CustomEvent" ); |
diff --git a/js/document/templates/banner/package.json b/js/document/templates/app/package.json index d1e839dc..4f36090a 100755 --- a/js/document/templates/banner/package.json +++ b/js/document/templates/app/package.json | |||
@@ -4,6 +4,7 @@ | |||
4 | }, | 4 | }, |
5 | "mappings": { | 5 | "mappings": { |
6 | "montage": "../../../../node_modules/montage/", | 6 | "montage": "../../../../node_modules/montage/", |
7 | "tools": "../../../../node_modules/tools/", | ||
7 | "montage-google": "../../../../node_modules/montage-google/" | 8 | "montage-google": "../../../../node_modules/montage-google/" |
8 | } | 9 | } |
9 | } \ No newline at end of file | 10 | } \ No newline at end of file |
diff --git a/js/document/templates/banner/index.html b/js/document/templates/banner/index.html index 91ef06de..f1ee3d98 100755 --- a/js/document/templates/banner/index.html +++ b/js/document/templates/banner/index.html | |||
@@ -81,7 +81,7 @@ | |||
81 | 81 | ||
82 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | 82 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> |
83 | 83 | ||
84 | <script type="text/javascript" data-package="." src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> | 84 | <script type="text/javascript" data-package="../app" src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> |
85 | 85 | ||
86 | <script type="text/montage-serialization" data-ninja-template="true"> | 86 | <script type="text/montage-serialization" data-ninja-template="true"> |
87 | { | 87 | { |
diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index a1b8b242..933df157 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html | |||
@@ -12,6 +12,9 @@ | |||
12 | must set the 'data-ninja-template' | 12 | must set the 'data-ninja-template' |
13 | data-ninja-template="true" | 13 | data-ninja-template="true" |
14 | --> | 14 | --> |
15 | |||
16 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | ||
17 | |||
15 | <html> | 18 | <html> |
16 | 19 | ||
17 | <head> | 20 | <head> |
@@ -58,10 +61,8 @@ | |||
58 | return document.elementFromPoint(x,y); | 61 | return document.elementFromPoint(x,y); |
59 | } | 62 | } |
60 | </script> | 63 | </script> |
61 | |||
62 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | ||
63 | 64 | ||
64 | <script type="text/javascript" data-package="." src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> | 65 | <script type="text/javascript" data-package="../app" src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> |
65 | 66 | ||
66 | <script type="text/montage-serialization" data-ninja-template="true"> | 67 | <script type="text/montage-serialization" data-ninja-template="true"> |
67 | { | 68 | { |
diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js deleted file mode 100644 index d5ac88d5..00000000 --- a/js/document/templates/html/main.js +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | var Montage = require("montage/core/core").Montage, | ||
7 | Component = require("montage/ui/component").Component; | ||
8 | |||
9 | exports.Main = Montage.create(Component, { | ||
10 | |||
11 | hasTemplate: { | ||
12 | value: false | ||
13 | }, | ||
14 | |||
15 | /** | ||
16 | * Adding window hooks to callback into this object from Ninja. | ||
17 | */ | ||
18 | templateDidLoad: { | ||
19 | value: function(){ | ||
20 | var self = this; | ||
21 | window.addComponent = function(element, data, callback) { | ||
22 | var component; | ||
23 | |||
24 | component = require.async(data.path) | ||
25 | .then(function(component) { | ||
26 | var componentRequire = component[data.name]; | ||
27 | var componentInstance = componentRequire.create(); | ||
28 | |||
29 | componentInstance.element = element; | ||
30 | |||
31 | componentInstance.needsDraw = true; | ||
32 | componentInstance.ownerComponent = self; | ||
33 | |||
34 | callback(componentInstance, element); | ||
35 | }) | ||
36 | .end(); | ||
37 | |||
38 | }; | ||
39 | |||
40 | // Dispatch event when this template has loaded. | ||
41 | /* | ||
42 | var newEvent = document.createEvent( "CustomEvent" ); | ||
43 | newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); | ||
44 | document.body.dispatchEvent( newEvent ); | ||
45 | */ | ||
46 | |||
47 | } | ||
48 | } | ||
49 | }); \ No newline at end of file | ||
diff --git a/js/document/templates/html/package.json b/js/document/templates/html/package.json deleted file mode 100755 index c8bc02fb..00000000 --- a/js/document/templates/html/package.json +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | { | ||
2 | "directories": { | ||
3 | "lib": "" | ||
4 | }, | ||
5 | "mappings": { | ||
6 | "montage": "../../../../node_modules/montage/" | ||
7 | } | ||
8 | } \ No newline at end of file | ||
diff --git a/js/document/templates/preview/banner.html b/js/document/templates/preview/banner.html new file mode 100755 index 00000000..5838ec91 --- /dev/null +++ b/js/document/templates/preview/banner.html | |||
@@ -0,0 +1,64 @@ | |||
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 | <html> | ||
9 | |||
10 | <head> | ||
11 | |||
12 | <style type="text/css"> | ||
13 | |||
14 | html, body { | ||
15 | width: 100%; | ||
16 | height: 100%; | ||
17 | margin: 0; | ||
18 | padding: 0; | ||
19 | background: #333; | ||
20 | } | ||
21 | |||
22 | .preview { | ||
23 | position: absolute; | ||
24 | top: 50%; | ||
25 | left: 50%; | ||
26 | margin: 0; | ||
27 | padding: 0; | ||
28 | border: 1px solid #000; | ||
29 | background: #FFF; | ||
30 | -webkit-box-shadow: 0 0 16px #000; | ||
31 | } | ||
32 | |||
33 | </style> | ||
34 | |||
35 | <script type="text/javascript"> | ||
36 | // | ||
37 | window.addEventListener('load', loadBanner, false); | ||
38 | // | ||
39 | function loadBanner (e) { | ||
40 | var iframe = document.getElementsByTagName('iframe')[0]; | ||
41 | iframe.src = qs('url'); | ||
42 | iframe.style.width = qs('width')+'px'; | ||
43 | iframe.style.height = qs('height')+'px'; | ||
44 | iframe.style.marginLeft = -1*qs('width')/2+'px'; | ||
45 | iframe.style.marginTop = -1*qs('height')/2+'px'; | ||
46 | } | ||
47 | /* | ||
48 | Taken from: |