Skip to content

Commit 6a604ff

Browse files
Added exemption quiz results functionality
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent c097c24 commit 6a604ff

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

css/styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ textarea {
7676
font-size: 20px;
7777
}
7878

79+
.exemptions-quiz-container #quiz-subheading {
80+
margin: 10px 0px 20px 0px;
81+
}
82+
83+
/* .results-container p {
84+
margin: 20px 0px;
85+
} */
86+
7987
@keyframes slideDown {
8088
from {
8189
opacity: 0;

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@
6161
<div id="form-header"></div>
6262

6363
<div id="exemptions">
64-
<p id="exemptions-header"></p>
64+
<div id="exemptions-header"></div>
6565
<div class="exemptions-quiz-container">
66+
<h4 id="quiz-subheading"> Answer the series of questions below to determine if your project falls under the
67+
4 exemption categories according to the SHARE IT Act. </h4>
6668
<div id="exemptions-quiz">
6769
<fieldset class="usa-fieldset">
6870
<div class="usa-checkbox">
@@ -125,15 +127,13 @@
125127
</div>
126128
</fieldset>
127129
<button type="button" onclick="determineExemptions()">Submit</button>
128-
<br>
129130
</div>
130131
</div>
131132
<div class="results" style="display: none;">
132133
<div class="results-container">
133134
<p class="exemption-result">Your project </p>
134-
<br>
135135
</div>
136-
<a href="#" class="doc-link" onclick="handleClick(event)">Try Again</a>
136+
<button onclick="handleClick(event)">Try Again</button>
137137
</div>
138138
</div>
139139

js/exemptionQuizHandler.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,36 @@ function determineExemptions() {
1010

1111
console.log("Selected answers:", checkedValues);
1212

13+
const results = determineResults(checkedValues);
14+
1315
// Display results
1416
quizContainer.style.display = "none";
1517
resultsContainer.style.display = "block";
16-
exemptionResult.innerHTML = `Your project is: <strong>EXEMPTED</strong><br />
17-
<p>This will be denoted by. The field has been filled out according in the form below.</p>`;
18+
exemptionResult.innerHTML = results;
19+
}
20+
21+
function determineResults(checkedValues) {
22+
23+
var text = "";
24+
25+
// Project qualifies for the SHARE IT Act
26+
if (checkedValues.includes("none")) {
27+
text = `<h4>Your project is: <strong>NOT EXEMPTED</strong></h4>
28+
<p>Based on your selections, your project qualifies for the SHARE IT Act ✅</p>
29+
<p>If your repository is public, mark <code>usageType</code> as <strong>openSource</strong>.</p>
30+
<p>If your repository is private/internal, mark <code>usageType</code> as <strong>governmentWideReuse</strong>.</p>`;
31+
}
32+
// Project is exempted
33+
else {
34+
const selections = checkedValues.join(", ");
35+
text = `<h4>Your project is: <strong>EXEMPTED</strong></h4>
36+
<p>Based on your selections, your project is exempted from the SHARE IT Act ❌</p>
37+
<p>We've marked this in the form below for you as: <strong>${selections}</strong></p>
38+
<p>Be sure to include a 1–2 sentence justification in the <code>exemptionText</code> field to support the exemption determination.</p>`;
39+
}
40+
41+
return text;
42+
1843
}
1944

2045
function uncheckAllCheckboxes() {

js/generateFormComponents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function createFormHeading(title, description) {
256256

257257
function createExemptionsBox() {
258258
const container = document.getElementById("exemptions-header")
259-
container.innerHTML = `<div class="step-header"><div class="step-number">1</div><h3>Is my project exempted from the SHARE IT Act?</h3></div> \n <h4> Answer the series of questions below to determine if your project falls under the 4 exemption categories according to the SHARE IT Act. </h4>`
259+
container.innerHTML = `<div class="step-header"><div class="step-number">1</div><h3>Is my project exempted from the SHARE IT Act?</h3></div>`
260260
}
261261

262262
function createAutoGenerationBox() {

0 commit comments

Comments
 (0)