Web Dev Solutions

Catalin Mititiuc

From 517c89b1cca85638f26d9987bc8b222d0a56ec6b Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Mon, 20 May 2024 14:07:00 -0700 Subject: Fix custom affiliation names --- src/modules/record_sheet.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index a9fb1c4..bf28875 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -161,12 +161,14 @@ export function start(startLoc, units, gbUnSelect, gbSelect) { const forces = createRecords(units); for (const affiliation in forces) { - const container = document.querySelector(`#${affiliation}-record .records`); - const name = startLoc.dataset[`#${affiliation}-record ${affiliation}Name`]; + const container = document.querySelector(`#${affiliation}-record`); + const records = container.querySelector('.records'); + const name = startLoc.dataset[`${affiliation}Name`]; + if (name) { container.querySelector('.name').textContent = name; } - forces[affiliation].forEach(r => container.appendChild(r)); + forces[affiliation].forEach(r => records.appendChild(r)); } addEventListeners(gbUnSelect, gbSelect); -- cgit v1.2.3