aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/elements/component-controller.js13
-rwxr-xr-xjs/controllers/selection-controller.js25
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js29
-rw-r--r--node_modules/components-data/map.json12
-rw-r--r--node_modules/components-data/youtube-channel.json2
-rw-r--r--node_modules/montage/examples/feed-reader/images/47-fuel.pngbin0 -> 3091 bytes
-rw-r--r--node_modules/montage/examples/feed-reader/images/80-shopping-cart.pngbin0 -> 2963 bytes
-rw-r--r--node_modules/montage/examples/feed-reader/images/88-beer-mug.pngbin0 -> 3087 bytes
-rw-r--r--node_modules/montage/examples/feed-reader/main.reel/main.html58
-rw-r--r--node_modules/montage/examples/feed-reader/main.reel/main.js10
-rwxr-xr-xnode_modules/montage/examples/youtube-channel-example/index.html11
-rw-r--r--node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html1
-rw-r--r--node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js10
-rw-r--r--node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html28
-rw-r--r--node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js100
-rw-r--r--node_modules/montage/ui/map.reel/map.html35
-rw-r--r--node_modules/montage/ui/map.reel/map.js74
-rw-r--r--node_modules/montage/ui/youtube-channel.reel/youtube-channel.js19
-rw-r--r--node_modules/montage/ui/youtube-player.reel/youtube-player.html10
-rw-r--r--node_modules/montage/ui/youtube-player.reel/youtube-player.js38
20 files changed, 325 insertions, 150 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 83450d0f..260ee8a0 100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, {
11 11
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el);
15
14 switch(prop) { 16 switch(prop) {
15 case "id": 17 case "id":
16 case "class": 18 case "class":
@@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, {
19 case "width": 21 case "width":
20 case "height": 22 case "height":
21 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { 23 if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) {
22 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 24 return component[prop];
23 } else { 25 } else {
24 return ElementController.getProperty(el, prop, true); 26 return ElementController.getProperty(el, prop, true);
25 } 27 }
26 default: 28 default:
27 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; 29 return component[prop];
28 } 30 }
29 } 31 }
30 }, 32 },
31 33
32 setProperty: { 34 setProperty: {
33 value: function(el, p, value) { 35 value: function(el, p, value) {
36 var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el);
37
34 switch(p) { 38 switch(p) {
35 case "id": 39 case "id":
36 case "class": 40 case "class":
@@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, {
39 case "width": 43 case "width":
40 case "height": 44 case "height":
41 if(el.nodeName === "IMG" && (p === "width" || p === "height")) { 45 if(el.nodeName === "IMG" && (p === "width" || p === "height")) {
42 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; 46 component[p] = value;
43 } else { 47 } else {
44 ElementController.setProperty(el, p, value); 48 ElementController.setProperty(el, p, value);
45 } 49 }
46 break; 50 break;
47 default: 51 default:
48 if(p === "min" || p === "max") value = parseFloat(value); 52 if(p === "min" || p === "max") value = parseFloat(value);
49 53 component[p] = value;
50 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
51 break; 54 break;
52 55
53 } 56 }
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 154fb7f8..fa82d4cc 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7 7
8var Montage = require("montage/core/core").Montage, 8var Montage = require("montage/core/core").Montage,
9 Component = require("montage/ui/component").Component; 9 Component = require("montage/ui/component").Component,
10 NJUtils = require("js/lib/NJUtils").NJUtils;
10 11
11exports.SelectionController = Montage.create(Component, { 12exports.SelectionController = Montage.create(Component, {
12 13
@@ -154,6 +155,28 @@ exports.SelectionController = Montage.create(Component, {
154 this._isDocument = true; 155 this._isDocument = true;
155 } 156 }
156 157
158 if(item && item.controller && !item.elementModel.isComponent) {
159 var componentInfo = Montage.getInfoForObject(item.controller);
160 var componentName = componentInfo.objectName.toLowerCase();
161 switch(componentName) {
162 case "feedreader":
163 NJUtils.makeElementModel(item, "Feed Reader", "component", false);
164 item.elementModel.pi = "FeedReaderPi";
165 item.elementModel.isComponent = true;
166 break;
167 case "map":
168 NJUtils.makeElementModel(item, "Map", "component", false);
169 item.elementModel.pi = "MapPi";
170 item.elementModel.isComponent = true;
171 break;
172 case "youtubechannel":
173 NJUtils.makeElementModel(item, "Youtube Channel", "component", false);
174 item.elementModel.pi = "YoutubeChannelPi";
175 item.elementModel.isComponent = true;
176 break;
177 }
178 }
179
157 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 180 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
158 181
159 } 182 }
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index dcb69255..599eeda3 100755
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -159,15 +159,19 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
159 _loadComponents: { 159 _loadComponents: {
160 value: function() { 160 value: function() {
161 161
162 this.componentsToLoad = this.components.children[0].children.length; 162 for(var cat in this.components.children) {
163 163
164 for(var i = 0, component; component = this.components.children[0].children[i]; i++) { 164 this.componentsToLoad += this.components.children[cat].children.length;
165 var req = new XMLHttpRequest(); 165
166 //req.identifier = "searchRequest"; 166 for(var i = 0, component; component = this.components.children[cat].children[i]; i++) {
167 req.open("GET", component.dataFile); 167 var req = new XMLHttpRequest();
168 req.addEventListener("load", this, false); 168 //req.identifier = "searchRequest";
169 req.addEventListener("error", this, false); 169 req.open("GET", component.dataFile);
170 req.send(); 170 req.addEventListener("load", this, false);
171 req.addEventListener("error", this, false);
172 req.send();
173 }
174
171 } 175 }
172 } 176 }
173 }, 177 },
@@ -287,6 +291,13 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
287 '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' 291 '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'
288 }; 292 };
289 293
294 var defaultStyles = component.defaultStyles;
295 if(defaultStyles) {
296 for(var n in defaultStyles) {
297 styles[n] = defaultStyles[n];
298 }
299 }
300
290 that.application.ninja.currentDocument.setComponentInstance(instance, element); 301 that.application.ninja.currentDocument.setComponentInstance(instance, element);
291 302
292 NJevent("elementAdding", {"el": element, "data":styles}); 303 NJevent("elementAdding", {"el": element, "data":styles});
diff --git a/node_modules/components-data/map.json b/node_modules/components-data/map.json
index 796b2fad..655d222d 100644
--- a/node_modules/components-data/map.json
+++ b/node_modules/components-data/map.json
@@ -8,8 +8,8 @@
8 "properties": [ 8 "properties": [
9 { 9 {
10 "name": "category", 10 "name": "category",
11 "type": "string", 11 "type": "select",
12 "default": "", 12 "default": "restaurant",
13 "possibleValues": ["restaurant", "hospital", "cafe", "museum"] 13 "possibleValues": ["restaurant", "hospital", "cafe", "museum"]
14 }, 14 },
15 { 15 {
@@ -18,5 +18,11 @@
18 "default": "" 18 "default": ""
19 } 19 }
20 20
21 ] 21 ],
22
23 "defaultStyles": {
24 "width": "280px",
25 "height": "280px"
26 }
27
22} \ No newline at end of file 28} \ No newline at end of file
diff --git a/node_modules/components-data/youtube-channel.json b/node_