diff options
author | Armen Kesablyan | 2012-05-17 13:33:28 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-17 13:33:28 -0700 |
commit | ee3702894b5c69a74f47b22aa5f2c8f58ad0179c (patch) | |
tree | 7b4dba1e5a4212c770c95aef9e45c81ce5626007 /js/panels/objects/objects-panel.reel | |
parent | c8d61c8e72e0eba266575f9df54325fa77fde73d (diff) | |
parent | 7e94d5786df400b599df3233b3086bfe9eff2bde (diff) | |
download | ninja-ee3702894b5c69a74f47b22aa5f2c8f58ad0179c.tar.gz |
Merge pull request #3 from ericguzman/binding
Binding: Objects Panel Initialization
Diffstat (limited to 'js/panels/objects/objects-panel.reel')
3 files changed, 160 insertions, 0 deletions
diff --git a/js/panels/objects/objects-panel.reel/objects-panel.css b/js/panels/objects/objects-panel.reel/objects-panel.css new file mode 100644 index 00000000..3fa3c479 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.css | |||
@@ -0,0 +1,37 @@ | |||
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 | |||
7 | /* | ||
8 | |||
9 | <section data-montage-id="objects-panel" class="objects-panel"> | ||
10 | <ul data-montage-id="list" class="objects-list"> | ||
11 | <li data-montage-id="list-item" class="list-item"></li> | ||
12 | </ul> | ||
13 | </section> | ||
14 | |||
15 | */ | ||
16 | |||
17 | .objects-list { | ||
18 | margin: 10px 0 0 0; | ||
19 | padding: 0; | ||
20 | } | ||
21 | .objects-list .list-item { | ||
22 | list-style-type: none; | ||
23 | float: left; | ||
24 | } | ||
25 | .object-icon { | ||
26 | background-color: #fff; | ||
27 | border: 1px solid #353535; | ||
28 | border-radius: 5px; | ||
29 | height: 50px; | ||
30 | margin: 0 15px 5px; | ||
31 | width: 50px; | ||
32 | } | ||
33 | .object-label { | ||
34 | color: #fff; | ||
35 | display: block; | ||
36 | text-align: center; | ||
37 | } \ No newline at end of file | ||
diff --git a/js/panels/objects/objects-panel.reel/objects-panel.html b/js/panels/objects/objects-panel.reel/objects-panel.html new file mode 100644 index 00000000..d68a59c0 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.html | |||
@@ -0,0 +1,70 @@ | |||
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 | <html> | ||
8 | <head> | ||
9 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
10 | <link rel="stylesheet" type="text/css" href="objects-panel.css"> | ||
11 | |||
12 | <script type="text/montage-serialization"> | ||
13 | { | ||
14 | "owner": { | ||
15 | "prototype": "js/panels/objects/objects-panel.reel", | ||
16 | "properties": { | ||
17 | "element": {"#": "objects-panel"} | ||
18 | } | ||
19 | }, | ||
20 | "repetition" : { | ||
21 | "prototype": "montage/ui/repetition.reel", | ||
22 | "properties": { | ||
23 | "element": {"#": "list"}, | ||
24 | "contentController": {"@": "arrayController"} | ||
25 | } | ||
26 | }, | ||
27 | "arrayController": { | ||
28 | "prototype": "montage/ui/controller/array-controller", | ||
29 | "bindings": { | ||
30 | "content" : { | ||
31 | "boundObject": {"@": "owner"}, | ||
32 | "boundObjectPropertyPath": "objects", | ||
33 | "oneway": true | ||
34 | } | ||
35 | } | ||
36 | }, | ||
37 | "objectComponent": { | ||
38 | "prototype": "js/panels/objects/object.reel", | ||
39 | "properties": { | ||
40 | "element": {"#": "list-item"} | ||
41 | }, | ||
42 | "bindings": { | ||
43 | "sourceObject" : { | ||
44 | "boundObject": {"@": "repetition"}, | ||
45 | "boundObjectPropertyPath": "objectAtCurrentIteration", | ||
46 | "oneway": true | ||
47 | }, | ||
48 | "identifier" : { | ||
49 | "boundObject": {"@": "repetition"}, | ||
50 | "boundObjectPropertyPath": "objectAtCurrentIteration.identifier", | ||
51 | "oneway": true | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | |||
56 | } | ||
57 | </script> | ||
58 | |||
59 | </head> | ||
60 | <body> | ||
61 | |||
62 | |||
63 | <section data-montage-id="objects-panel" class="objects-panel"> | ||
64 | <ul data-montage-id="list" class="objects-list"> | ||
65 | <li data-montage-id="list-item" class="list-item"></li> | ||
66 | </ul> | ||
67 | </section> | ||
68 | |||
69 | </body> | ||
70 | </html> | ||
diff --git a/js/panels/objects/objects-panel.reel/objects-panel.js b/js/panels/objects/objects-panel.reel/objects-panel.js new file mode 100644 index 00000000..a1c381a2 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.js | |||
@@ -0,0 +1,53 @@ | |||
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 | |||
7 | /** | ||
8 | @requires montage/core/core | ||
9 | @requires montage/ui/component | ||
10 | */ | ||
11 | var Montage = require("montage/core/core").Montage, | ||
12 | Component = require("montage/ui/component").Component; | ||
13 | |||
14 | exports.ObjectsPanel = Montage.create(Component, { | ||
15 | _objects: { value: null }, | ||
16 | objects: { | ||
17 | get: function() { | ||
18 | return this._objects; | ||
19 | }, | ||
20 | set: function(value) { | ||
21 | this._objects = value; | ||
22 | this.needsDraw = true; | ||
23 | } | ||
24 | }, | ||
25 | |||
26 | |||
27 | templateDidLoad: { | ||
28 | value: function() { | ||
29 | console.log('objects panel loaded'); | ||
30 | } | ||
31 | }, | ||
32 | |||
33 | prepareForDraw : { | ||
34 | value: function() { | ||
35 | |||
36 | Object.defineBinding(this, 'objects', { | ||
37 | "boundObject": this.application.ninja.objectsController, | ||
38 | "boundObjectPropertyPath": "objects", | ||
39 | "oneway": true | ||
40 | }); | ||
41 | |||
42 | } | ||
43 | }, | ||
44 | draw : { | ||
45 | value: function() { | ||
46 | console.log("objects panel draw"); | ||
47 | if(this.objects) { | ||
48 | |||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | }); \ No newline at end of file | ||