From 96912755c2b163d9aa3a0bdaadd67ae607769f5c Mon Sep 17 00:00:00 2001 From: Happyrobot33 Date: Wed, 29 May 2024 13:54:04 -0400 Subject: [PATCH] add incomplete toggle --- WebDocEditor/WebDocEditor.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/WebDocEditor/WebDocEditor.js b/WebDocEditor/WebDocEditor.js index a498c7d..6367be9 100644 --- a/WebDocEditor/WebDocEditor.js +++ b/WebDocEditor/WebDocEditor.js @@ -112,6 +112,7 @@ class Member{ let div = document.createElement("div"); div.classList.add("member"); div.innerHTML = "

" + this.name + "

"; + EditableToggle(div, "incomplete", this.incomplete); EditableField(div, "docURL", this.URL); EditableField(div, "summary", this.summary); EditableField(div, "remarks", this.remarks); @@ -161,6 +162,25 @@ function EditableField(div, fieldName, fieldValue){ div.appendChild(fieldDiv); } +function EditableToggle(div, fieldName, fieldValue){ + //make a div to put the label and textarea in + let fieldDiv = document.createElement("div"); + fieldDiv.classList.add("node"); + //div.innerHTML += ""; + //div.innerHTML += ""; + let content = document.createElement("input"); + content.type = "checkbox"; + content.checked = fieldValue; + fieldDiv.appendChild(content); + //create the label + let label = document.createElement("label"); + label.htmlFor = fieldName; + label.innerHTML = fieldName + ":"; + fieldDiv.insertBefore(label, content); + content.addEventListener("input", updateOutput); + div.appendChild(fieldDiv); +} + //initial setup window.onload = function(){ let xml_input = document.getElementById("xml_input");