Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate footnotes from json #80

Merged
merged 4 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agency-scorecards/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h1>Agency Scorecards</h1>
The annual scorecard assesses how well federal agencies reach their small business contracting goals. The SBA issues scorecards to the twenty-four (24) CFO Act Agencies.
</p>
<table>
<caption>FY <span data-fiscal_year></span> Scorecard Performance</caption>
<caption>FY 2023 Scorecard Performance</caption>
<thead>
<tr>
<th>Acronym</th>
Expand Down
8 changes: 6 additions & 2 deletions agency-scorecards/js/hydrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ var hydrator = (function() {

// If any elements exist that match the data key, then fill in data on each element (node)
nodeList.forEach(function(node) {
node.textContent = value;
node.setAttribute(`data-${key}`, value);
if (key === 'prime_footnotes' || key === 'sub_footnotes') {
node.innerHTML = value;
} else {
node.textContent = value;
node.setAttribute(`data-${key}`, value);
}
});

} else {
Expand Down
4 changes: 3 additions & 1 deletion agency-scorecards/js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

// Variables
let agencyData = {};
let dataURL = 'https://api.sba.gov/agency-scorecards'
let scorecardData = [];
const dataURL = window.location.href.indexOf("sba.gov") > -1

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
sba.gov
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
? 'https://api.sba.gov/agency-scorecards'
: `${window.location.href.slice(0, window.location.href.lastIndexOf('/'))}/data`

// Public API
let public = {};
Expand Down
2 changes: 0 additions & 2 deletions agency-scorecards/scorecard.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ <h2>Prime Contracting Achievement</h2>
</table>
<p data-prime_footnotes></p>
<!-- This will need to be marked with a data- attribute when the data set updates to handle it -->
<p>Prime contracting data as of February 22, 2023.</p>
</details>

<div class="section-charts">
Expand Down Expand Up @@ -250,7 +249,6 @@ <h2>Subcontracting Achievement</h2>
</table>
<p data-sub_footnotes></p>
<!-- This will need to be marked with a data- attribute when the data set updates to handle it -->
<p>Subcontracting data as of March 15, 2023.</p>
</details>
<div class="section-charts">
<div>
Expand Down
Loading