Skip to content

Commit

Permalink
Merge pull request #25 from unboxed/jquery
Browse files Browse the repository at this point in the history
Fix bug caused by different append() behaviour
  • Loading branch information
HonTastic2 committed Jul 25, 2024
2 parents b3f4716 + cb2c2ed commit 1c0ec3d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ function ready(fn) {
}
}

function generateElements(html) {
const template = document.createElement('template');
template.innerHTML = html.trim();
return template.content;
}

// const fetchApplicationDocs = async(ref) => {
// try {
// const response = await axios.get(apiUrl + ref + "/documents");
Expand Down Expand Up @@ -175,6 +181,8 @@ function App () {

if (data === null) {return;}

const table = document.querySelector("#applicationTable").querySelector('tbody')

for (let i = 0; i < Object.keys(data.features).length; i++) {
var feature = data.features[i].properties;

Expand All @@ -184,14 +192,14 @@ function App () {
<td class='govuk-table__cell'>${feature.description}</td>
<td class='govuk-table__cell'>${feature.recvDate}</td>
<td class='govuk-table__cell'>${humanize(feature.status)}</td>`;
if (feature.publicUrl === undefined) { featureHTML += `<td class='govuk-table__cell'>N/A</td></tr>`;}
else {

if (feature.publicUrl === undefined) { featureHTML += `<td class='govuk-table__cell'>N/A</td></tr>`; }

else {
featureHTML += `<td class='govuk-table__cell'><a class='govuk-link' href='${feature.publicUrl}' target='_blank'>More info</a></td></tr>`;
}

document.querySelector("#applicationTable").querySelector('tbody').append(featureHTML);
table.append(generateElements(featureHTML));
}
}
}
Expand Down

0 comments on commit 1c0ec3d

Please sign in to comment.