Skip to content

Commit

Permalink
add incomplete toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Happyrobot33 committed May 29, 2024
1 parent 6cfd4db commit 9691275
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions WebDocEditor/WebDocEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class Member{
let div = document.createElement("div");
div.classList.add("member");
div.innerHTML = "<h2>" + this.name + "</h2>";
EditableToggle(div, "incomplete", this.incomplete);
EditableField(div, "docURL", this.URL);
EditableField(div, "summary", this.summary);
EditableField(div, "remarks", this.remarks);
Expand Down Expand Up @@ -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 += "<label for='" + fieldName + "'>" + fieldName + ":</label>";
//div.innerHTML += "<textarea id='" + fieldName + "' rows='4' cols='50'>" + fieldValue + "</textarea>";
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");
Expand Down

0 comments on commit 9691275

Please sign in to comment.