addfield updated to support new schema

parent 53489608
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
} }
return gadget.declareGadget("../expandable_field/index.html"); return gadget.declareGadget("../expandable_field/index.html");
} }
if (property_definition.properties) {
// Create a recursive fieldset for this key.
return gadget.declareGadget("../fieldset/index.html");
}
if (property_definition.type === "object") { if (property_definition.type === "object") {
// Create a recursive fieldset for this key. // Create a recursive fieldset for this key.
return gadget.declareGadget("../fieldset/index.html"); return gadget.declareGadget("../fieldset/index.html");
...@@ -94,22 +98,26 @@ ...@@ -94,22 +98,26 @@
.forEach(function (property_name) { .forEach(function (property_name) {
var property_definition = var property_definition =
options.property_definition.properties[property_name], options.property_definition.properties[property_name],
value = property_definition.default, value,
i=0, property; i=0, property;
if (property_definition.allOf) { if (property_definition) {
if (property_definition.allOf[0].properties) { value = property_definition.default || {};
for (property in property_definition if (property_definition.allOf) {
.allOf[0].properties) { if (property_definition.allOf[0].properties) {
if (property_definition.allOf[0] for (property in property_definition
.properties.hasOwnProperty(property)) { .allOf[0].properties) {
i += 1; if (property_definition.allOf[0]
if (i > 1) {console.log("something is wrong!");} .properties.hasOwnProperty(property)) {
value = property_definition.allOf[0] i += 1;
.properties[property].default; if (i > 1) {console.log("something is wrong!");}
value = property_definition.allOf[0]
.properties[property].default;
}
} }
} }
} }
} }
console.log("TRYING TO FIND A VALUE!!!!"); console.log("TRYING TO FIND A VALUE!!!!");
console.log(options); console.log(options);
console.log(options.value); console.log(options.value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment