Commit 3b69c6cb authored by Jérome Perrin's avatar Jérome Perrin

fieldset: generate nested fieldset (disabled for now because it breaks expandable field)

parent 8e05c059
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
//console.log("addField", property_id, property_definition, value); //console.log("addField", property_id, property_definition, value);
queue queue
.push(function () { .push(function () {
// XXX this is incorrect for recursive fieldsets. gadget.props.fieldset_element.insertAdjacentHTML(
// we should use nested fieldset with legend
gadget.props.element.insertAdjacentHTML(
'beforeend', 'beforeend',
label_template({ label_template({
"for": property_id, "for": property_id,
...@@ -73,24 +71,29 @@ ...@@ -73,24 +71,29 @@
return sub_gadget.getElement(); return sub_gadget.getElement();
}) })
.push(function (sub_element) { .push(function (sub_element) {
gadget.props.element.appendChild(sub_element); gadget.props.fieldset_element.appendChild(sub_element);
gadget.props.field_gadget_list.push(sub_gadget); gadget.props.field_gadget_list.push(sub_gadget);
}); });
} }
queue = new RSVP.Queue() queue = new RSVP.Queue()
.push(function () { .push(function () {
//gadget.props.fieldset_element = document.createElement("fieldset");
//gadget.props.element.appendChild(gadget.props.fieldset_element);
gadget.props.fieldset_element = gadget.props.element;
if (gadget.props.key) {
// style only recursive fieldsets
gadget.props.fieldset_element.style["border-width"] = "1px";
}
if (node_id) { if (node_id) {
addField('id', {'type': 'string'}, node_id); addField('id', {'type': 'string'}, node_id);
} }
//console.log(options.property_definition);
Object.keys(options.property_definition.properties Object.keys(options.property_definition.properties
).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 = (options.value || {})[property_name] === undefined value = (options.value || {})[property_name] === undefined
? property_definition.default : options.value[property_name]; ? property_definition.default : options.value[property_name];
//console.log(property_name, property_definition);
// XXX some properties are not editable // XXX some properties are not editable
// XXX should not be defined here // XXX should not be defined here
if (property_name !== 'coordinate' && if (property_name !== 'coordinate' &&
......
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