Skip to content
Snippets Groups Projects
Commit e10d1d38 authored by Mathias Chouet's avatar Mathias Chouet Committed by mathias.chouet
Browse files

PreBarrage: add default structure when adding wall

parent ff962a80
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,6 @@ export class FormulairePrebarrage extends FormulaireFixedVar { ...@@ -106,7 +106,6 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
wallForm.addObserver(this); // @TODO why not this.form ? wallForm is just a dummy form to extract elements from… wallForm.addObserver(this); // @TODO why not this.form ? wallForm is just a dummy form to extract elements from…
ServiceFactory.instance.formulaireService.loadUpdateFormulaireLocalisation(wallForm); ServiceFactory.instance.formulaireService.loadUpdateFormulaireLocalisation(wallForm);
// add fieldsets for existing Structures // add fieldsets for existing Structures
console.log(`Node ${node.uid} : ${node.structures.length} structures, Form ${this.uid} : ${this._kids.length} form elements`);
if (node.structures.length > 0) { if (node.structures.length > 0) {
for (const struct of node.structures) { for (const struct of node.structures) {
for (const e of wallForm.allFormElements) { for (const e of wallForm.allFormElements) {
...@@ -116,8 +115,13 @@ export class FormulairePrebarrage extends FormulaireFixedVar { ...@@ -116,8 +115,13 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
} }
} }
} else { } else {
// if there was no existing structure, add a default one ! @TODO // if there was no existing structure, add a default one
console.log("TODO add default structure"); for (const e of wallForm.allFormElements) {
if (e instanceof FieldsetContainer) {
e.addFromTemplate(0);
break;
}
}
} }
this.showFormElements(wallForm); this.showFormElements(wallForm);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment