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