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.js78
1 files changed, 39 insertions, 39 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
index 14213d56..ee203336 100644
--- a/js/controllers/objects-controller.js
+++ b/js/controllers/objects-controller.js
@@ -94,15 +94,15 @@ var objectsController = exports.ObjectsController = Montage.create(Component, {
94 if(descriptors.hasOwnProperty(property)) { 94 if(descriptors.hasOwnProperty(property)) {
95 descriptor = descriptors[property]; 95 descriptor = descriptors[property];
96 96
97 bindingArgsObject = { 97 bindingArgsObject = {
98 sourceObject : object, 98 sourceObject : object,
99 sourceObjectPropertyPath : property, 99 sourceObjectPropertyPath : property,
100 boundObject : descriptor.boundObject, 100 boundObject : descriptor.boundObject,
101 boundObjectPropertyPath : descriptor.boundObjectPropertyPath, 101 boundObjectPropertyPath : descriptor.boundObjectPropertyPath,
102 oneway : descriptor.oneway 102 oneway : descriptor.oneway
103 }; 103 };
104 104
105 bindingsArray.push(bindingArgsObject); 105 bindingsArray.push(bindingArgsObject);
106 } 106 }
107 } 107 }
108 } 108 }
@@ -113,46 +113,46 @@ var objectsController = exports.ObjectsController = Montage.create(Component, {
113 113
114 /* ---- Bindable Properties ---- */ 114 /* ---- Bindable Properties ---- */
115 115
116 getPropertiesList : { 116 getPropertyList : {
117 value: function(object, groupByPrototype) { 117 value: function(object, excludeUnderscoreProperties) {
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";
132 120
133 return { 121 ///// Collect prototypes
134 category : objectName, 122 while(Object.getPrototypeOf(object_i)) {
135 properties : Montage.getSerializablePropertyNames(proto) 123 object_i = Object.getPrototypeOf(object_i);
136 }; 124 prototypes.push(object_i);
137 }, this);
138 } else {
139 list = Montage.getSerializablePropertyNames(object);
140 } 125 }
141 126
127 return prototypes.map(function(proto) {
128
129 var metadata = proto._montage_metadata,
130 objectName = (metadata) ? metadata.objectName : "Object";
142 131
143 return list; 132 return {
133 category : objectName,
134 properties : this.getPropertiesFromObject(proto)
135 };
136 }, this);
144 137
145 } 138 }
146 }, 139 },
147 140
148 getBindablePropertiesFromObject : { 141 getPropertiesFromObject : {
149 value: function (object) { 142 value: function (object, excludeUnderscoreProperties) {
150 var serializableProperties = Montage.getSerializablePropertyNames(object), 143 var properties = [];
151 properties;
152 144
153 properties = serializableProperties.filter(function(prop) { 145 for(var key in object) {
154 return object.hasOwnProperty(prop); 146 if(object.hasOwnProperty(key)) {
155 }, this); 147 properties.push(key);
148 }
149 }
150
151 if(excludeUnderscoreProperties) {
152 properties = properties.filter(function(property) {
153 return property[0] !== '_';
154 }, this);
155 }
156 156
157 return properties.sort(); 157 return properties.sort();
158 } 158 }