From a9a6d479e4f00134b32f7c3e657de3ce5cfb0c48 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 11 Jun 2012 10:27:49 -0700 Subject: Objects Panel - Add component icon and icons by type --- js/controllers/objects-controller.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 2ce10e82..93f78efc 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -119,20 +119,11 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, - /* ---- Bindable Properties ---- */ + /* ---- Get Bindable Properties ---- */ getPropertyList : { value: function(object, excludeUnderscoreProperties) { - var object_i = object, - prototypes = [object_i]; - - ///// Collect prototypes - while(Object.getPrototypeOf(object_i)) { - object_i = Object.getPrototypeOf(object_i); - prototypes.push(object_i); - } - - return prototypes.map(function(proto) { + return this.getPrototypes(object).map(function(proto) { var metadata = proto._montage_metadata, objectName = (metadata) ? metadata.objectName : "Object"; @@ -166,6 +157,21 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, + getPrototypes : { + value: function(object) { + var object_i = object, + prototypes = [object_i]; + + ///// Collect prototypes + while(Object.getPrototypeOf(object_i)) { + object_i = Object.getPrototypeOf(object_i); + prototypes.push(object_i); + } + + return prototypes; + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 1f855ae600c9f796bb8c6abe01fd7f9ffd15a1ac Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 12 Jun 2012 12:57:58 -0700 Subject: Objects Controller - Add concept of categories --- js/controllers/objects-controller.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index f700c03c..7da70520 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -7,6 +7,10 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; +var CATEGORIES = { + +}; + var objectsController = exports.ObjectsController = Montage.create(Component, { _currentDocument : { @@ -172,6 +176,29 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, + /* ----- Category properties ----- */ + + getObjectCategory : { + value: function(object) { + if(this._hasPrototype(object, 'Component')) { + return 'Component'; + } + + return null; + } + }, + + _hasPrototype : { + value: function(object, prototypeName) { + var prototypes = this.getPrototypes(object).map(function(proto) { + var metadata = proto._montage_metadata; + return (metadata) ? metadata.objectName : "Object"; + }); + + return prototypes.indexOf(prototypeName) !== -1; + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 1c32ba9a460bbb737206ce10d1ea75f035f543b7 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 11:29:53 -0700 Subject: Objects Controller - Update current object bindings when adding/removing bindings --- js/controllers/objects-controller.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 7da70520..386ef683 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -66,6 +66,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); + this.currentObjectBindings = this.getObjectBindings(value); } }, @@ -76,6 +77,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); + this.currentObjectBindings = this.getObjectBindings(value); } }, @@ -92,6 +94,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } this.addBinding(bindingArgs); + } }, -- cgit v1.2.3