diff options
author | Armen Kesablyan | 2012-05-31 22:05:33 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-31 22:05:33 -0700 |
commit | 50ea77b261e1b3676aea2b1ed582d5e6c97a0997 (patch) | |
tree | fd317d8de8eaec728376c60273b1f6a214816e8e /js/panels | |
parent | b7e33c16bab26f8ee0daa61f920cfdbcb7abc6e3 (diff) | |
parent | 04ef4ffcfde762a0aead4a7b702f3c019fdbeb69 (diff) | |
download | ninja-50ea77b261e1b3676aea2b1ed582d5e6c97a0997.tar.gz |
Merge pull request #4 from ericguzman/binding
Binding
Diffstat (limited to 'js/panels')
-rw-r--r-- | js/panels/binding-panel.reel/binding-panel.css | 11 | ||||
-rw-r--r-- | js/panels/binding-panel.reel/binding-panel.html | 26 | ||||
-rw-r--r-- | js/panels/binding-panel.reel/binding-panel.js | 14 | ||||
-rw-r--r-- | js/panels/binding/binding-item.reel/binding-item.css | 13 | ||||
-rw-r--r-- | js/panels/binding/binding-item.reel/binding-item.html | 37 | ||||
-rw-r--r-- | js/panels/binding/binding-item.reel/binding-item.js | 26 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.html | 2 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.js | 32 |
8 files changed, 132 insertions, 29 deletions
diff --git a/js/panels/binding-panel.reel/binding-panel.css b/js/panels/binding-panel.reel/binding-panel.css index e69de29b..8597a926 100644 --- a/js/panels/binding-panel.reel/binding-panel.css +++ b/js/panels/binding-panel.reel/binding-panel.css | |||
@@ -0,0 +1,11 @@ | |||
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 | .bindings-list { | ||
9 | padding: 0; | ||
10 | margin: 0; | ||
11 | } \ No newline at end of file | ||
diff --git a/js/panels/binding-panel.reel/binding-panel.html b/js/panels/binding-panel.reel/binding-panel.html index 0db7b95f..d2e18e99 100644 --- a/js/panels/binding-panel.reel/binding-panel.html +++ b/js/panels/binding-panel.reel/binding-panel.html | |||
@@ -15,6 +15,28 @@ | |||
15 | "properties": { | 15 | "properties": { |
16 | "element": {"#": "binding"} | 16 | "element": {"#": "binding"} |
17 | } | 17 | } |
18 | }, | ||
19 | "arrayController": { | ||
20 | "prototype": "montage/ui/controller/array-controller", | ||
21 | "bindings": { | ||
22 | "content" : {"<-": "@owner.bindings" } | ||
23 | } | ||
24 | }, | ||
25 | "repetition": { | ||
26 | "prototype": "montage/ui/repetition.reel", | ||
27 | "properties": { | ||
28 | "element": {"#": "bindings-list"}, | ||
29 | "contentController": {"@": "arrayController"} | ||
30 | } | ||
31 | }, | ||
32 | "bindingItem": { | ||
33 | "prototype": "js/panels/binding/binding-item.reel", | ||
34 | "properties": { | ||
35 | "element": {"#": "binding-item"} | ||
36 | }, | ||
37 | "bindings": { | ||
38 | "sourceObjectPropertyPath": {"<-": "@repetition.objectAtCurrentIteration.sourceObjectPropertyPath"} | ||
39 | } | ||
18 | } | 40 | } |
19 | 41 | ||
20 | } | 42 | } |
@@ -22,7 +44,9 @@ | |||
22 | </head> | 44 | </head> |
23 | <body> | 45 | <body> |
24 | <div data-montage-id="binding"> | 46 | <div data-montage-id="binding"> |
25 | this is a test | 47 | <ul data-montage-id="bindings-list" class="bindings-list"> |
48 | <li data-montage-id="binding-item" class="binding-item"></li> | ||
49 | </ul> | ||
26 | </div> | 50 | </div> |
27 | </body> | 51 | </body> |
28 | </html> \ No newline at end of file | 52 | </html> \ No newline at end of file |
diff --git a/js/panels/binding-panel.reel/binding-panel.js b/js/panels/binding-panel.reel/binding-panel.js index 03fe5723..9fdec416 100644 --- a/js/panels/binding-panel.reel/binding-panel.js +++ b/js/panels/binding-panel.reel/binding-panel.js | |||
@@ -4,6 +4,20 @@ var Montage = require("montage/core/core").Montage, | |||
4 | 4 | ||
5 | exports.BindingPanel = Montage.create(Component, { | 5 | exports.BindingPanel = Montage.create(Component, { |
6 | 6 | ||
7 | bindings : { | ||
8 | value: null | ||
9 | }, | ||
10 | |||
11 | templateDidLoad : { | ||
12 | value: function() { | ||
13 | Object.defineBinding(this, 'bindings', { | ||
14 | boundObject: this.application.ninja.objectsController, | ||
15 | boundObjectPropertyPath: "currentObjectBindings", | ||
16 | oneway: true | ||
17 | }); | ||
18 | } | ||
19 | }, | ||
20 | |||
7 | prepareForDraw: { | 21 | prepareForDraw: { |
8 | value: function() { | 22 | value: function() { |
9 | console.log("test- objects"); | 23 | console.log("test- objects"); |
diff --git a/js/panels/binding/binding-item.reel/binding-item.css b/js/panels/binding/binding-item.reel/binding-item.css new file mode 100644 index 00000000..dc90f162 --- /dev/null +++ b/js/panels/binding/binding-item.reel/binding-item.css | |||
@@ -0,0 +1,13 @@ | |||
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 | .binding-item { | ||
8 | color: #FFF; | ||
9 | margin: 0 8px; | ||
10 | padding: 3px; | ||
11 | border-bottom: 1px solid #FFF; | ||
12 | list-style-type: none; | ||
13 | } \ No newline at end of file | ||
diff --git a/js/panels/binding/binding-item.reel/binding-item.html b/js/panels/binding/binding-item.reel/binding-item.html new file mode 100644 index 00000000..23182345 --- /dev/null +++ b/js/panels/binding/binding-item.reel/binding-item.html | |||
@@ -0,0 +1,37 @@ | |||
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 lang="en"> | ||
8 | <head> | ||
9 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
10 | <link rel="stylesheet" href="binding-item.css" type="text/css"> | ||
11 | <script type="text/montage-serialization"> | ||
12 | { | ||
13 | "owner": { | ||
14 | "prototype": "js/panels/binding/binding-item.reel", | ||
15 | "properties": { | ||
16 | "element": {"#": "binding-item"} | ||
17 | } | ||
18 | }, | ||
19 | "label": { | ||
20 | "prototype": "montage/ui/dynamic-text.reel", | ||
21 | "properties": { | ||
22 | "element": {"#": "label"} | ||
23 | }, | ||
24 | "bindings": { | ||
25 | "value": {"<-": "@owner.sourceObjectPropertyPath"} | ||
26 | } | ||
27 | } | ||
28 | |||
29 | } | ||
30 | </script> | ||
31 | </head> | ||
32 | <body> | ||
33 | <li data-montage-id="binding-item" class="binding-item"> | ||
34 | <span data-montage-id="label"></span> | ||
35 | </li> | ||
36 | </body> | ||
37 | </html> \ No newline at end of file | ||
diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js new file mode 100644 index 00000000..9365da65 --- /dev/null +++ b/js/panels/binding/binding-item.reel/binding-item.js | |||
@@ -0,0 +1,26 @@ | |||
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 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | |||
11 | exports.BindingItem = Montage.create(Component, { | ||
12 | |||
13 | sourceObjectPropertyPath : { value: null }, | ||
14 | |||
15 | templateDidLoad : { | ||
16 | value: function() { | ||
17 | console.log("loaded binding item"); | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | prepareForDraw: { | ||
22 | value: function() { | ||
23 | console.log("preparing to draw binding item"); | ||
24 | } | ||
25 | } | ||
26 | }); \ No newline at end of file | ||
diff --git a/js/panels/objects/object.reel/object.html b/js/panels/objects/object.reel/object.html index efc66d79..a072ab5e 100644 --- a/js/panels/objects/object.reel/object.html +++ b/js/panels/objects/object.reel/object.html | |||
@@ -38,7 +38,7 @@ | |||
38 | <body> | 38 | <body> |
39 | 39 | ||
40 | 40 | ||
41 | <li data-montage-id="object"> | 41 | <li data-montage-id="object" draggable="true"> |
42 | <div class="object-icon"></div> | 42 | <div class="object-icon"></div> |
43 | <span data-montage-id="label" class="object-label"></span> | 43 | <span data-montage-id="label" class="object-label"></span> |
44 | </li> | 44 | </li> |
diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 953c1baf..43abafad 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js | |||
@@ -57,41 +57,19 @@ exports.Object = Montage.create(Component, { | |||
57 | get: function() { | 57 | get: function() { |
58 | return this._montageLabel; | 58 | return this._montageLabel; |
59 | }, | 59 | }, |
60 | set: function(value) { | 60 | set: function(data) { |
61 | if(this._montageMetaData === value) { return false; } | 61 | if(this._montageMetaData === data) { return false; } |
62 | 62 | ||
63 | this._montageMetaData = value; | 63 | this._montageMetaData = data; |
64 | 64 | ||
65 | if(!this.identifier && value.label) { | 65 | if(!this.identifier && data.label) { |
66 | this.label = value.label; | 66 | this.label = data.label; |
67 | this.needsDraw = true; | 67 | this.needsDraw = true; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | }, |