aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/objects-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/objects-controller.js')
-rw-r--r--js/controllers/objects-controller.js59
1 files changed, 30 insertions, 29 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
index 32f24d5c..14213d56 100644
--- a/js/controllers/objects-controller.js
+++ b/js/controllers/objects-controller.js
@@ -113,45 +113,46 @@ var objectsController = exports.ObjectsController = Montage.create(Component, {
113 113
114 /* ---- Bindable Properties ---- */ 114 /* ---- Bindable Properties ---- */
115 115
116 getPropertyList : { 116 getPropertiesList : {
117 value: function(object, excludeUnderscoreProperties) { 117 value: function(object, groupByPrototype) {
118 var object_i = object, 118 var object_i = object,
119 prototypes = [object_i]; 119 prototypes = [object_i],
120 list;
121
122 if(groupByPrototype) {
123 ///// Collect prototypes
124 while(Object.getPrototypeOf(object_i)) {
125 object_i = Object.getPrototypeOf(object_i);
126 prototypes.push(object_i);
127 }
128
129 list = prototypes.map(function(proto) {
130 var metadata = proto._montage_metadata,
131 objectName = (metadata) ? metadata.objectName : "Object";
120 132
121 ///// Collect prototypes 133 return {
122 while(Object.getPrototypeOf(object_i)) { 134 category : objectName,
123 object_i = Object.getPrototypeOf(object_i); 135 properties : Montage.getSerializablePropertyNames(proto)
124 prototypes.push(object_i); 136 };
137 }, this);
138 } else {
139 list = Montage.getSerializablePropertyNames(object);
125 } 140 }
126 141
127 return prototypes.map(function(proto) {
128 var metadata = proto._montage_metadata,
129 objectName = (metadata) ? metadata.objectName : "Object";
130 142
131 return { 143 return list;
132 category : objectName,
133 properties : this.getPropertiesFromObject(proto)
134 };
135 }, this);
136 144
137 } 145 }
138 }, 146 },
139 147
140 getPropertiesFromObject : { 148 getBindablePropertiesFromObject : {
141 value: function (object, excludeUnderscoreProperties) { 149 value: function (object) {
142 var properties = []; 150 var serializableProperties = Montage.getSerializablePropertyNames(object),
151 properties;
143 152
144 for(var key in object) { 153 properties = serializableProperties.filter(function(prop) {
145 if(object.hasOwnProperty(key)) { 154 return object.hasOwnProperty(prop);
146 properties.push(key); 155 }, this);
147 }
148 }
149
150 if(excludeUnderscoreProperties) {
151 properties = properties.filter(function(property) {
152 return property[0] !== '_';
153 }, this);
154 }
155 156
156 return properties.sort(); 157 return properties.sort();
157 } 158 }