Skip to content

Commit 09db2a2

Browse files
committed
fix: fixing the js file for attributes tool
1 parent 11f6c63 commit 09db2a2

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

CodeListLibrary_project/cll/static/js/clinicalcode/forms/clinical/attributeSelectionService.js

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export class AttributeSelectionService {
341341
},true);
342342

343343
let doc = parseHTMLFromString(html,true);
344-
let modal = document.body.appendChild(doc.body.children[0]);
344+
let modal = document.body.appendChild(doc[0]);
345345

346346
// create footer
347347
let footer = createElement("div", {
@@ -355,11 +355,11 @@ export class AttributeSelectionService {
355355
// create buttons
356356
const buttons = {};
357357
let confirmBtn = parseHTMLFromString(CSEL_BUTTONS.CONFIRM,true);
358-
confirmBtn = footer.appendChild(confirmBtn.body.children[0]);
358+
confirmBtn = footer.appendChild(confirmBtn[0]);
359359
confirmBtn.innerText = this.options.promptConfirm;
360360

361361
let cancelBtn = parseHTMLFromString(CSEL_BUTTONS.CANCEL,true);
362-
cancelBtn = footer.appendChild(cancelBtn.body.children[0]);
362+
cancelBtn = footer.appendChild(cancelBtn[0]);
363363
cancelBtn.innerText = this.options.promptCancel;
364364

365365
buttons["confirm"] = confirmBtn;
@@ -380,7 +380,7 @@ export class AttributeSelectionService {
380380
if (this.options.allowMultiple) {
381381
html = CSEL_INTERFACE.TAB_VIEW;
382382
doc = parseHTMLFromString(html,true);
383-
contentContainer = body.appendChild(doc.body.children[0]);
383+
contentContainer = body.appendChild(doc[0]);
384384

385385
const tabs = contentContainer.querySelectorAll("button.tab-view__tab");
386386
for (let i = 0; i < tabs.length; ++i) {
@@ -663,7 +663,7 @@ export class AttributeSelectionService {
663663
},true);
664664

665665
let doc = parseHTMLFromString(html,true);
666-
let page = this.dialogue.content.appendChild(doc.body.children[0]);
666+
let page = this.dialogue.content.appendChild(doc[0]);
667667
this.dialogue.page = page;
668668

669669
this.#paintSelectionAttributes();
@@ -826,15 +826,15 @@ export class AttributeSelectionService {
826826
},true);
827827
let doc = parseHTMLFromString(attributerow);
828828
noneAvailable.classList.remove("show");
829-
page.appendChild(doc.body.children[0]);
829+
page.appendChild(doc[0]);
830830
} else {
831831
let attributerow = interpolateString(CSEL_INTERFACE.ATTRIBUTE_ACCORDION, {
832832
id: uniqueId,
833833
title: "New attribute value",
834834
content: attribute_progress,
835835
},true);
836836
let doc = parseHTMLFromString(attributerow);
837-
page.appendChild(doc.body.children[0]);
837+
page.appendChild(doc[0]);
838838
}
839839

840840
let attribute = {
@@ -1145,8 +1145,7 @@ export class AttributeSelectionService {
11451145
id: attribute.id,
11461146
}
11471147
);
1148-
const deleteButtonElement = parseHTMLFromString(accordionDeleteButton).body
1149-
.children[0];
1148+
const deleteButtonElement = parseHTMLFromString(accordionDeleteButton)[0];
11501149
accordionLabel.textContent = "";
11511150
accordionLabel.insertBefore(deleteButtonElement, accordionLabel.firstChild);
11521151
accordionLabel.appendChild(
@@ -1281,15 +1280,10 @@ export class AttributeSelectionService {
12811280
id: attribute.id,
12821281
});
12831282

1284-
attribute_progress = parseHTMLFromString(attribute_progress,true);
1283+
attribute_progress = parseHTMLFromString(attribute_progress,true)[0];
12851284

1286-
attribute_progress
1287-
.querySelector("#attribute-name-input-" + attribute.id)
1288-
.setAttribute("value", attribute.name);
1289-
attribute_progress
1290-
.querySelector("#attribute-type-" + attribute.id)
1291-
.querySelector(`option[value="${attribute.type}"]`)
1292-
.setAttribute("selected", true);
1285+
attribute_progress.querySelector("#attribute-name-input-" + attribute.id).setAttribute("value", attribute.name);
1286+
attribute_progress.querySelector("#attribute-type-" + attribute.id).querySelector(`option[value="${attribute.type}"]`).setAttribute("selected", true);
12931287

12941288
let attributerow = interpolateString(
12951289
CSEL_INTERFACE.ATTRIBUTE_ACCORDION,
@@ -1298,11 +1292,11 @@ export class AttributeSelectionService {
12981292
title: `${attribute.name} - ${this.#typeConversion(
12991293
attribute.type
13001294
)}`,
1301-
content: attribute_progress.body.outerHTML,
1295+
content: attribute_progress.outerHTML,
13021296
}
13031297
);
13041298

1305-
let doc = parseHTMLFromString(attributerow);
1299+
let doc = parseHTMLFromString(attributerow)[0];
13061300

13071301
const accordionLabel = doc.querySelector(
13081302
"#children-label-" + attribute.id
@@ -1313,8 +1307,7 @@ export class AttributeSelectionService {
13131307
id: attribute.id,
13141308
}
13151309
);
1316-
const deleteButtonElement = parseHTMLFromString(accordionDeleteButton)
1317-
.body.children[0];
1310+
const deleteButtonElement = parseHTMLFromString(accordionDeleteButton)[0];
13181311
accordionLabel.textContent = "";
13191312
accordionLabel.insertBefore(
13201313
deleteButtonElement,
@@ -1326,7 +1319,7 @@ export class AttributeSelectionService {
13261319
)
13271320
);
13281321

1329-
page.appendChild(doc.body.children[0]);
1322+
page.appendChild(doc);
13301323

13311324
attribute = this.#invokeAttributeInputs(attribute, page);
13321325
this.#invokeAttributeButtons(attribute, page);

0 commit comments

Comments
 (0)