From 444b626165ee8b2e30cc7b9bb3f4322c0ab9992f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 20 Mar 2012 14:21:16 -0700 Subject: giving the feed reader a default size when empty Signed-off-by: Valerio Virgillito --- node_modules/components-data/feed-reader.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node_modules/components-data/feed-reader.json b/node_modules/components-data/feed-reader.json index 6caf768d..aa9bf340 100644 --- a/node_modules/components-data/feed-reader.json +++ b/node_modules/components-data/feed-reader.json @@ -11,5 +11,9 @@ "type": "string", "default": null } - ] + ], + "defaultStyles": { + "width":"350px", + "height":"250px" + } } \ No newline at end of file -- cgit v1.2.3 From c0a1164b5e84098e005f076de5eddd0e60387286 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 20 Mar 2012 14:21:29 -0700 Subject: Fixing the selection issues Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 27 --------------------------- js/lib/NJUtils.js | 32 +++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5091f99a..9b0e638a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -155,33 +155,6 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; } - if(item && item.controller && !item.elementModel.isComponent) { - var componentInfo = Montage.getInfoForObject(item.controller); - var componentName = componentInfo.objectName.toLowerCase(); - switch(componentName) { - case "feedreader": - NJUtils.makeElementModel(item, "Feed Reader", "component", false); - item.elementModel.pi = "FeedReaderPi"; - item.elementModel.isComponent = true; - break; - case "map": - NJUtils.makeElementModel(item, "Map", "component", false); - item.elementModel.pi = "MapPi"; - item.elementModel.isComponent = true; - break; - case "youtubechannel": - NJUtils.makeElementModel(item, "Youtube Channel", "component", false); - item.elementModel.pi = "YoutubeChannelPi"; - item.elementModel.isComponent = true; - break; - case "picasacarousel": - NJUtils.makeElementModel(item, "Picasa Carousel", "component", false); - item.elementModel.pi = "PicasaCarouselPi"; - item.elementModel.isComponent = true; - break; - } - } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 4f1082f9..904aa41e 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -96,15 +96,45 @@ exports.NJUtils = Object.create(Object.prototype, { value: function(el, selection, controller, isShape) { var p3d = Montage.create(Properties3D).init(el); var shapeProps = null; + var pi = controller + "Pi"; + if(isShape) { shapeProps = Montage.create(ShapeModel); } + if(el.controller) { + + var componentInfo = Montage.getInfoForObject(el.controller); + var componentName = componentInfo.objectName.toLowerCase(); + + controller = "component"; + isShape = false; + + switch(componentName) { + case "feedreader": + selection = "Feed Reader"; + pi = "FeedReaderPi"; + break; + case "map": + selection = "Map"; + pi = "MapPi"; + break; + case "youtubechannel": + selection = "Youtube Channel"; + pi = "YoutubeChannelPi"; + break; + case "picasacarousel": + selection = "Picasa Carousel"; + pi = "PicasaCarouselPi"; + break; + } + } + el.elementModel = Montage.create(ElementModel, { type: { value: el.nodeName}, selection: { value: selection}, controller: { value: ControllerFactory.getController(controller)}, - pi: { value: controller + "Pi"}, + pi: { value: pi}, props3D: { value: p3d}, shapeModel: { value: shapeProps} }); -- cgit v1.2.3